├── All_Practice.asm ├── Divide.asm ├── F-Zero_Final.asm ├── GP2_Hover_Cars.asm ├── GP2_Hover_Cars_Hijacks.asm ├── GP2_Top_Down_Cars.bin ├── LICENSE ├── LoadBlockToVRAM.asm ├── Master_Ending.asm ├── Master_Ending_Hijacks.asm ├── PUT XKAS V0.06 HERE.txt ├── README.md ├── SRAM_Fix.asm ├── apply_patch.bat ├── apply_patch.sh └── master_images ├── Blue Thunder.png ├── Fire Scorpion.png ├── Green Amazone (top part unused).png └── Luna Bomber.png /All_Practice.asm: -------------------------------------------------------------------------------- 1 | ;========================================================= 2 | ; ALL PRACTICE MODE 3 | ;========================================================= 4 | 5 | !Str_Buf equ $0480 6 | 7 | ; Last track = 20 (instead of 7) 8 | org $008B4F 9 | CMP #$14 10 | 11 | ; Last track = 20-1 (instead of 7-1) 12 | org $008B5B 13 | LDA #$13 14 | 15 | ; Change a BNE to BRA 16 | org $009A63 17 | DB $80 18 | 19 | ; Load shortcut routine from GP table rather than practice 20 | org $00D619 21 | LDA $00DAC6, x 22 | 23 | ; "Adjust track name" as in setting the appropriate track number and variation (I/II/III) 24 | org $00AC0D 25 | Adjust_Track_Name: 26 | JSL Adjust_Track_Name_Hijack 27 | NOP 28 | NOP 29 | 30 | ; Change the track at the title screen to Port Town II 31 | org $0380AE 32 | LDA #$0C 33 | 34 | ; HOPEFULLY FIX ALL CASES OF WEIRDNESS ON TRACKS 8 TO 15 35 | org $02C33F 36 | JSL Get_Track_Num_x4 37 | 38 | org $03915C 39 | JSL Get_Track_Num_x4 40 | 41 | org $039171 42 | JSL Get_Track_Num_x4 43 | 44 | ; FIX THE MASTER ENDINGS 45 | org $039D58 46 | DB 4,9,14 ; SI, WL2, FF 47 | 48 | ; Freespace - NEW CODE GOES HERE 49 | org $02C1CC 50 | 51 | ;========================================================= 52 | ;========================================================= 53 | Get_Track_Num_x4: 54 | LDX #$00 55 | LDA $53 56 | %Divide($05) 57 | ASL A 58 | ASL A 59 | RTL 60 | ;========================================================= 61 | 62 | ;========================================================= 63 | ;========================================================= 64 | Adjust_Track_Name_Hijack: 65 | CMP #$09 ; A = $53 at this point 66 | BCC .one_digit 67 | LDA !Str_Buf 68 | SEC 69 | SBC #$04 70 | STA !Str_Buf ; Move text X starting position 4 pixels to the left 71 | LDY #$FF 72 | - INY 73 | LDA !Str_Buf+3,y 74 | BNE - 75 | 76 | ; Y is now the offset to the last character in !Str_Buf 77 | - LDA !Str_Buf+3,y 78 | STA !Str_Buf+4,y ; Shift each character right once 79 | DEY 80 | BPL - 81 | 82 | PHX 83 | 84 | LDX #$00 85 | 86 | LDA $53 87 | INC A 88 | 89 | %Divide($0A) 90 | 91 | PHA 92 | TXA 93 | 94 | CLC 95 | ADC #$80 ; 96 | STA !Str_Buf+3 97 | 98 | PLA 99 | 100 | CLC 101 | ADC #$80 102 | STA !Str_Buf+4 103 | 104 | PLX 105 | 106 | RTL 107 | 108 | .one_digit 109 | ADC #$81 ; += '1' 110 | STA !Str_Buf+3 111 | RTL 112 | ;========================================================= -------------------------------------------------------------------------------- /Divide.asm: -------------------------------------------------------------------------------- 1 | ;============================================================================ 2 | ; Performs division via subtraction on the A register 3 | ; The X register is used to calculate the quotient, and should be set to #$00 to start 4 | ; 5 | ; In: A contains the dividend 6 | ; Out: A contains the remainder, X contains the quotient 7 | ;============================================================================ 8 | macro Divide(DIVISOR) 9 | .loop 10 | CMP # 11 | BMI .finish 12 | 13 | SEC 14 | SBC # 15 | INX 16 | BRA .loop 17 | .finish 18 | endmacro 19 | -------------------------------------------------------------------------------- /F-Zero_Final.asm: -------------------------------------------------------------------------------- 1 | lorom 2 | 3 | ;========================================================= 4 | ; F-Zero Final v0.2 5 | ; Authors: Gregory Lewandowski (Grego), Richard Bukor (CatadorDeLatas) 6 | ; 7 | ; A mod to bring all of the content from BS F-Zero Grand Prix 2 into the original F-Zero and 8 | ; enhance F-Zero to handle custom maps/leagues/backgrounds/palettes etc. 9 | ; 10 | ; Please see the README for further detail. 11 | ;========================================================= 12 | 13 | ; The selected map 14 | !CURRENT_MAP equ $0053 15 | 16 | ; The base game state variable 17 | !GAME_STATE equ $0054 18 | 19 | ; Whether we are in practice mode, #$01 for true 20 | !PRACTICE_FLAG equ $0058 21 | 22 | ; Currently selected option when a menu is active 23 | !SELECTED_OPTION equ $005A 24 | 25 | ; The league selected 26 | !LEAGUE_SELECTION equ $0090 27 | 28 | !FZ_PALETTE_BANK equ $0F 29 | !FZ_PALETTE_TABLE_ADDRESS equ $00a465 30 | 31 | !FZ_TRACK_SETTINGS_TABLE_ADDRESS equ $02e129 32 | 33 | !FZ_TRACK_NAME_PTR equ $ac42 34 | 35 | !FZ_TRACK_BANK_TABLE equ $00a486 36 | !FZ_READ_ORG_TABLE equ $039f00 37 | 38 | !FZ_TILE_POOL_BANK equ $0C 39 | !FZ_TILE_POOL_ADDR equ $C380 40 | 41 | !FZ_TRACK_MINE_TABLE equ $0ce880 42 | 43 | !FZ_AI_CHECKPOINT_TABLE equ $e0f9 44 | 45 | !FZ_TRACK_GFX_TABLE equ $00a450 46 | 47 | !GP2_PALETTE_BANK equ $1F 48 | !GP2_PALETTE_TABLE_ADDRESS equ $10a204 49 | 50 | !GP2_TRACK_BANK_TABLE equ $10a225 51 | !GP2_READ_ORG_TABLE equ $139f00 52 | 53 | !GP2_TILE_POOL_BANK equ $1C 54 | 55 | !GP2_TRACK_MINE_TABLE equ $1ce880 56 | 57 | !GP2_AI_CHECKPOINT_TABLE equ $e000 58 | 59 | !GP2_TRACK_GFX_TABLE equ $10A1EF 60 | 61 | !GP2_TRACK_SETTINGS_TABLE_ADDRESS equ $12e02c 62 | 63 | !DECOMP_TRACK_BG_TILEMAP equ $039806 64 | 65 | !FZ_BG1_TILEMAP_OFFSET equ $00B19D 66 | !FZ_BG2_TILEMAP_OFFSET equ $00B19D+2 67 | 68 | !GP2_BG1_TILEMAP_OFFSET equ $10AFAE 69 | !GP2_BG2_TILEMAP_OFFSET equ $10AFAE+2 70 | 71 | ; Increase the leagues! 72 | !MAX_LEAGUE equ $03 73 | 74 | incsrc Divide.asm 75 | 76 | incsrc All_Practice.asm 77 | 78 | incsrc SRAM_Fix.asm 79 | 80 | incsrc Master_Ending.asm 81 | 82 | ;Set rom size to 2mb 83 | org $00FFD7 84 | DB $0B 85 | 86 | ; Hijack track variation loading so it may be disabled for custom/ace league 87 | org $009f9b 88 | JML Hijack_Track_Variations 89 | 90 | ; Label for jumping to the loop to handle track variations 91 | org $009fa1 92 | Handle_Track_Variations: 93 | 94 | ; Label for skipping track variation handling 95 | org $009fbc 96 | Skip_Track_Variations: 97 | 98 | ; Hijack track settings, Original code - lda $02e129,x 99 | org $009f1b 100 | JSL Hijack_Track_Settings 101 | 102 | org $009f28 103 | JSL Hijack_Track_Settings 104 | 105 | org $009f4c 106 | JSL Hijack_Track_Settings 107 | 108 | ; Hijack track palette loading 109 | org $00a127 110 | JML Hijack_Track_Palette_Loading 111 | 112 | ; Hijack read position and size for track data 113 | org $00A040 114 | JML Hijack_Read_Org_Size 115 | 116 | ; Hijack bank handling for track data 117 | org $00A05F 118 | JML Hijack_Set_Read_Bank 119 | 120 | ; Hijack track loading to load the correct tile pool 121 | org $009F08 122 | JML Hijack_Load_Track 123 | 124 | ; Hijack ai path bank, Original code - pea $0012; plb 125 | org $00d60b 126 | JML Hijack_AI_PEA 127 | 128 | ; Hijack ai paths 129 | org $00d645 130 | JML Hijack_AI_Checkpoint_Structure 131 | 132 | org $00D623 133 | JML Hijack_AI_Checkpoint_Structure 134 | 135 | ; Hijack mine data, Original code - lda #$0c00; sta $21; lda $0ce880,x 136 | org $00a317 137 | JML Hijack_Load_Track_Mines 138 | 139 | ; Hijack track gfx 140 | org $00a0cf 141 | JML Hijack_Load_Track_GFX 142 | 143 | ; Disable original league select drawing routine 144 | org $0387c8 145 | NOP 146 | NOP 147 | NOP 148 | 149 | ; Hijack the NMI handler 150 | org $0080D9 151 | JML Hijack_NMI 152 | 153 | ; Max leagues! 154 | org $0387bd 155 | CMP #!MAX_LEAGUE 156 | 157 | org $0387ac 158 | CMP #!MAX_LEAGUE 159 | 160 | ; Hijack bank when loading map graphics, Original code - pea $000f 161 | org $03971c 162 | JML Hijack_Upload_xbpp_As_4bpp 163 | 164 | ; Master class always available, Original code - lda $7f49fa 165 | org $0387eb 166 | LDA #$FF 167 | NOP 168 | NOP 169 | 170 | ; Stop handling practice mode differently when calculating sram offsets, Original code - bne $c313 171 | org $02c305 172 | NOP 173 | NOP 174 | 175 | ; Hijack track name handling 176 | org $00abd3 177 | JML Hijack_Track_Names 178 | 179 | ; Added grand prix 2 data to the rom 180 | org $108000 181 | incbin ../SNES_ROMS/F-Zero_Grand_Prix_2.sfc 182 | 183 | ; This must come after gp2 rom as it modifies it 184 | incsrc GP2_Hover_Cars.asm 185 | 186 | ; Make mute city iv use variation 3, gives it the dark horizon, messes up mini map loading ;( 187 | ; TODO: Make horizon table configurable. 188 | org $12e03b 189 | ;DB $E7 190 | 191 | ; Load BG1 horizon for race 192 | org $00A4C9 193 | PHX 194 | JSL Hijack_Load_Track_BG1 195 | BRA $01 ; NOP*3 196 | 197 | ; Load BG2 horizon for race 198 | org $00A518 199 | JSL Hijack_Load_Track_BG2 200 | BRA $01 ; NOP*3 201 | 202 | ; Load BG1 horizon for records 203 | org $038D38 204 | JSL Hijack_Load_Track_BG1 205 | BRA $01 ; NOP*3 206 | 207 | ; Load BG2 horizon for records 208 | org $038D4A 209 | JSL Hijack_Load_Track_BG2 210 | BRA $01 ; NOP*3 211 | 212 | org $00a11d 213 | JML Hijack_Horizon_Gradient 214 | 215 | ;Dem hacks 216 | org $308000 217 | incsrc LoadBlockToVRAM.asm 218 | 219 | incsrc GP2_Hover_Cars_Hijacks.asm 220 | 221 | incsrc Master_Ending_Hijacks.asm 222 | 223 | Top_Down_GP2_Cars_GFX: 224 | incbin GP2_Top_Down_Cars.bin 225 | 226 | ;========================================================= 227 | ; Hijack the NMI handler to draw our custom league menu 228 | ;========================================================= 229 | Hijack_NMI: 230 | ; Original code from $0080D9 231 | REP #$30 232 | PHA 233 | PHX 234 | PHY 235 | PHD 236 | PHB 237 | ; Original code from $0080D9 238 | 239 | LDA !GAME_STATE 240 | CMP #$0501 ; Game state equal to #$01 (menu) and game state + 1 equal to #$05 (league selection)? 241 | BNE .continue 242 | 243 | JSR Draw_Custom_League_Menu 244 | 245 | .continue 246 | 247 | CMP #$0101 248 | BNE .exit 249 | 250 | ;JSR Draw_Custom_Car_Selection_Screen 251 | 252 | .exit 253 | JML $0080e0 254 | ;========================================================= 255 | 256 | ;========================================================= 257 | ; Draws the custom league menu in the same fashion as the class selector. 258 | ;========================================================= 259 | Draw_Custom_League_Menu: 260 | LDA !SELECTED_OPTION 261 | CLC 262 | ASL A 263 | 264 | TAX 265 | 266 | SEP #$20 267 | 268 | JSR (LEAGUE_SELECTION_JSR_TABLE, X) 269 | 270 | ; Erase the queen and king league tiles 271 | %LoadBlockToVRAM($30, SELECT_LEAGUE_CLEAR_TILES, $05B0, $1A) 272 | %LoadBlockToVRAM($30, SELECT_LEAGUE_CLEAR_TILES, $05F0, $1A) 273 | 274 | REP #$20 275 | 276 | RTS 277 | ;========================================================= 278 | 279 | ;========================================================= 280 | ; Determines the offset to use when accessing the hijack tables. 281 | ; The offset for all hijack tables is determined by (league * 2), however 282 | ; for practice mode the league is always #$00, so we must divide the map 283 | ; number by #$05 to determine the league first. 284 | ;========================================================= 285 | Get_League_Table_Offset: 286 | PHX 287 | PHP 288 | 289 | SEP #$20 290 | 291 | LDA !PRACTICE_FLAG 292 | BEQ .not_practice 293 | 294 | REP #$30 295 | 296 | LDX #$0000 297 | 298 | LDA !CURRENT_MAP 299 | AND #$00FF 300 | 301 | %Divide($0005) 302 | 303 | TXA 304 | 305 | BRA .end 306 | 307 | .not_practice 308 | REP #$30 309 | 310 | LDA !LEAGUE_SELECTION 311 | 312 | .end 313 | CLC 314 | ASL A ; Mult by 2 315 | 316 | PLP 317 | PLX 318 | 319 | RTS 320 | ;========================================================= 321 | 322 | ;========================================================= 323 | ; Hijack the loading of xbpp graphics, by changing the bank we can control 324 | ; which set of mini maps load. 325 | ; 326 | ; TODO: Enhance this as it will currently only work for GP2 and FZ maps, the address loaded needs to be configurable for custom leagues 327 | ;========================================================= 328 | Hijack_Upload_xbpp_As_4bpp: 329 | JSR Get_League_Table_Offset 330 | 331 | PHX ; Preserve X! 332 | 333 | TAX 334 | 335 | REP #$20 336 | 337 | LDA UPLOAD_XBPP_BANK_TABLE, X 338 | 339 | PHA ; Push on two bytes 340 | 341 | PLB ; Pull one 342 | 343 | SEP #$20 344 | 345 | PLA ; Preserve the top byte (#$00) 346 | 347 | PLX ; Get X back off the stack 348 | 349 | PHA ; Push the top byte back on, a PLB at the end of xbpp upload will pull this value to return the bank register to #$00 350 | 351 | JML $039720 352 | ;========================================================= 353 | 354 | ;========================================================= 355 | ; Hijack the beginning of track loading to load custom tile pools, necessary as FZ and GP2 do not share a tile pool. 356 | ; Custom maps and leagues will also require their own tile pools, unless we get very lucky. ;D 357 | ;========================================================= 358 | Hijack_Load_Track: 359 | PHP 360 | PHB 361 | 362 | REP #$30 363 | 364 | JSR Load_Tile_Pool 365 | 366 | SEP #$30 367 | 368 | PLB 369 | 370 | LDA #$00 371 | 372 | JML $009F0D 373 | ;========================================================= 374 | 375 | ;========================================================= 376 | ; Hijack track setting loading, custom leagues and GP2 require their own set of track settings data. 377 | ;========================================================= 378 | Hijack_Track_Settings: 379 | JSR Get_League_Table_Offset 380 | 381 | PHY 382 | 383 | TXY 384 | TAX 385 | 386 | JSR (TRACK_SETTINGS_JSR_TABLE, X) 387 | 388 | PLY 389 | 390 | RTL 391 | ;========================================================= 392 | 393 | ;========================================================= 394 | ; Hijack the loading of track palettes, GP2 and custom maps will have custom palettes 395 | ;========================================================= 396 | Hijack_Track_Palette_Loading: 397 | JSR Get_League_Table_Offset 398 | 399 | TAX 400 | 401 | JSR (LOAD_PALETTE_JSR_TABLE, X) 402 | 403 | JML $00a133 404 | ;========================================================= 405 | 406 | ;========================================================= 407 | ; Hijack the loading of track data's address and size 408 | ;========================================================= 409 | Hijack_Read_Org_Size: 410 | JSR Get_League_Table_Offset 411 | 412 | PHY 413 | 414 | TXY 415 | TAX 416 | 417 | JSR (READ_ORG_SIZE_JSR_TABLE, X) 418 | 419 | PLY 420 | 421 | JML $00a04c 422 | ;========================================================= 423 | 424 | ;========================================================= 425 | ; Hijack the loading of track data's bank. 426 | ;========================================================= 427 | Hijack_Set_Read_Bank: 428 | TAY 429 | 430 | JSR Get_League_Table_Offset 431 | 432 | PHX 433 | 434 | TAX 435 | 436 | JSR (SET_READ_BANK_JSR_TABLE, X) 437 | 438 | PLX 439 | 440 | JML $00a068 441 | ;========================================================= 442 | 443 | ;========================================================= 444 | ; Hijack the loading of track graphics, will be useful for custom track tiles... someday. 445 | ;========================================================= 446 | Hijack_Load_Track_GFX: 447 | PHX 448 | 449 | JSR Get_League_Table_Offset 450 | 451 | TAX 452 | 453 | JSR (LOAD_TRACK_GFX_JSR_TABLE, X) 454 | 455 | PLX 456 | 457 | JML $00a0dd 458 | ;========================================================= 459 | 460 | ;========================================================= 461 | ; Loads the correct tilepool for the current league. GP2 and custom leagues will have their own tilepools. 462 | ;========================================================= 463 | Load_Tile_Pool: 464 | JSR Get_League_Table_Offset 465 | 466 | TAX 467 | 468 | LDA #$24FF 469 | LDY #$0000 470 | 471 | JSR (TILE_POOL_JSR_TABLE, X) 472 | 473 | RTS 474 | ;========================================================= 475 | 476 | ;========================================================= 477 | ; Hijack the loading of track mines to use the correct table for the league 478 | ;========================================================= 479 | Hijack_Load_Track_Mines: 480 | JSR Get_League_Table_Offset 481 | 482 | PHY 483 | 484 | TXY 485 | TAX 486 | 487 | JSR (TRACK_MINES_JSR_TABLE, X) 488 | 489 | PLY 490 | 491 | JML $00a320 492 | ;========================================================= 493 | 494 | ;========================================================= 495 | ; Hijack the beginning of AI checkpoint loading to use the correct bank for the current league. 496 | ;========================================================= 497 | Hijack_AI_PEA: 498 | JSR Get_League_Table_Offset 499 | 500 | PHX 501 | 502 | TAX 503 | 504 | REP #$20 505 | 506 | LDA AI_CHECKPOINT_BANK_TABLE, X 507 | 508 | PHA 509 | PLB ; This is tricky, a PLB is performed at the end of the load ai path method, the upper byte of A (#$00) is left on the stack for it 510 | 511 | SEP #$20 512 | 513 | PLA 514 | 515 | PLX 516 | 517 | PHA 518 | 519 | JML $00d60f 520 | ;========================================================= 521 | 522 | ;========================================================= 523 | ; Hijack the ai checkpoint loading to use the correct table for the league. 524 | ;========================================================= 525 | Hijack_AI_Checkpoint_Structure: 526 | REP #$20 527 | 528 | JSR Get_League_Table_Offset 529 | 530 | PHX 531 | PHY 532 | 533 | TXY 534 | TAX 535 | 536 | JSR (AI_CHECKPOINT_JSR_TABLE, X) 537 | 538 | STA $30 539 | 540 | PLY 541 | PLX 542 | 543 | JML $00d64a 544 | ;========================================================= 545 | 546 | ;========================================================= 547 | ; Hijack track variation handling, used to disable track variations for GP2 and custom leagues. 548 | ;========================================================= 549 | Hijack_Track_Variations: 550 | ; Original code from $009f9b 551 | LDA $28 552 | AND #$00FF 553 | TAY 554 | ; Original code from $009f9b 555 | 556 | JSR Get_League_Table_Offset 557 | 558 | TAX 559 | 560 | LDA TRACK_MODIFICATIONS_ENABLED_TABLE, X 561 | BNE .continue 562 | 563 | JML Skip_Track_Variations 564 | 565 | .continue 566 | JML Handle_Track_Variations 567 | ;========================================================= 568 | 569 | ;========================================================= 570 | ; Hijack track name loading, allows for GP2 and custom leagues to have custom map names. 571 | ;========================================================= 572 | Hijack_Track_Names: 573 | 574 | JSR Get_League_Table_Offset 575 | 576 | PHB 577 | PHX 578 | 579 | TAX 580 | 581 | ; Load from the correct bank 582 | LDA TRACK_NAME_BANK_TABLE, X 583 | 584 | PHA 585 | PLB 586 | 587 | REP #$30 588 | 589 | ; Load from the correct track name table 590 | LDA TRACK_NAME_PTR_TABLE, X 591 | 592 | STA $00 593 | 594 | TYA 595 | 596 | ADC $0000 ; We are adding Y (the name offset) with the address of the ptr table to derive a pointer to the starting address for the track name 597 | 598 | TAX 599 | 600 | LDA $0000, X ; X contains the address for an entry in the ptr table, this leaves A containing the address to the track name 601 | 602 | STA $0000 603 | 604 | SEP #$30 605 | 606 | ; Original code from $00ABCB 607 | LDY #$00 608 | .write_buffer 609 | LDA ($00),Y 610 | STA $0480,Y 611 | BEQ .end_of_buffer 612 | 613 | INY 614 | BRA .write_buffer 615 | 616 | .end_of_buffer 617 | ; Original code from $00ABCB 618 | 619 | PLX 620 | PLB 621 | 622 | JML $00abe9 623 | ;========================================================= 624 | 625 | ;========================================================= 626 | ; Hijack the loading of the track BG1 horizon to use the correct table for GP2 if necessary 627 | ;========================================================= 628 | Hijack_Load_Track_BG1: 629 | PHP 630 | 631 | JSR Get_League_Table_Offset 632 | 633 | TXY 634 | TAX 635 | 636 | REP #$20 637 | JSR (LOAD_TRACK_BG1_JSR_TABLE, X) 638 | 639 | JSL !DECOMP_TRACK_BG_TILEMAP 640 | 641 | PLP 642 | 643 | RTL 644 | ;========================================================= 645 | 646 | ;========================================================= 647 | ; Hijack the loading of the track BG2 horizon to use the correct table for GP2 if necessary 648 | ;========================================================= 649 | Hijack_Load_Track_BG2: 650 | PHP 651 | 652 | JSR Get_League_Table_Offset 653 | 654 | TXY 655 | TAX 656 | 657 | REP #$20 658 | JSR (LOAD_TRACK_BG2_JSR_TABLE, X) 659 | 660 | JSL !DECOMP_TRACK_BG_TILEMAP 661 | 662 | PLP 663 | 664 | RTL 665 | ;========================================================= 666 | 667 | ;========================================================= 668 | ; What bank to use for the call to Upload_xbpp_As_4bpp, used to hijack minimap loading. 669 | ; TODO: Handle minimap graphics addresses to allow for custom leagues to locate their minimap graphics anywhere. 670 | ;========================================================= 671 | UPLOAD_XBPP_BANK_TABLE: 672 | DW $000f, $000f, $000f, $001f 673 | ;========================================================= 674 | 675 | ;========================================================= 676 | ; Hijack track name tables 677 | ;========================================================= 678 | TRACK_NAME_BANK_TABLE: 679 | DW $0000, $0000, $0000, $0030 680 | 681 | TRACK_NAME_PTR_TABLE: 682 | DW !FZ_TRACK_NAME_PTR, !FZ_TRACK_NAME_PTR, !FZ_TRACK_NAME_PTR, GP2_TRACK_NAME_PTR 683 | ;========================================================= 684 | 685 | ;========================================================= 686 | ; Track names and track name ptr table for GP2 687 | ;========================================================= 688 | GP2_TRACK_NAME_PTR: 689 | DW BIG_BLUE_II_TRACK_NAME 690 | DW SILENCE_II_TRACK_NAME 691 | DW BLANK_TRACK_NAME 692 | DW SAND_STORM_TRACK_NAME 693 | DW BLANK_TRACK_NAME 694 | DW BLANK_TRACK_NAME 695 | DW SAND_STORM_TRACK_NAME 696 | DW MUTE_CITY_IV_TRACK_NAME 697 | DW BLANK_TRACK_NAME 698 | 699 | SILENCE_II_TRACK_NAME: ; Silence ii 700 | DB $44, $53, $01, $82, $1B, $FF, $A0, $8E, $6F, $68, $8B, $66, $68, $FF, $FE, $FF, $00 701 | 702 | BIG_BLUE_II_TRACK_NAME: ; Bigblue ii 703 | DB $44, $53, $01, $81, $1B, $FF, $65, $8E, $6A, $FF, $65, $6F, $A2, $68, $FF, $FE, $FF, $00 704 | 705 | SAND_STORM_TRACK_NAME: ; Sandstorm 706 | DB $44, $53, $01, $87, $1B, $FF, $A0, $64, $8B, $67, $FF, $A0, $A1, $8C, $8F, $8A, $FF, $FE, $FF, $00 707 | 708 | MUTE_CITY_IV_TRACK_NAME: ; Mute city iv 709 | DB $44, $53, $01, $88, $1B, $FF, $8A, $A2, $A1, $68, $FF, $66, $8E, $A1, $A5, $FF, $8E, $A3, $00 710 | 711 | BLANK_TRACK_NAME: 712 | DB $44, $53, $01, $88, $1B, $00 713 | ;========================================================= 714 | 715 | 716 | ;========================================================= 717 | ; Hijacks the loading of horizon gradients allowing GP2 and custom tracks to specify their horizon gradients regardless of venue 718 | ;========================================================= 719 | Hijack_Horizon_Gradient: 720 | 721 | JSR Get_League_Table_Offset 722 | 723 | PHX 724 | 725 | TAX 726 | 727 | JSR (HORIZON_GRADIENT_JSR_TABLE, X) 728 | 729 | STA $9c 730 | 731 | PLX 732 | 733 | JML $00a122 734 | ;========================================================= 735 | 736 | ;========================================================= 737 | ; Horizon gradient hijack tables 738 | ;========================================================= 739 | HORIZON_GRADIENT_JSR_TABLE: 740 | DW FZ_HORIZON_GRADIENT, FZ_HORIZON_GRADIENT, FZ_HORIZON_GRADIENT, GP2_HORIZON_GRADIENT 741 | 742 | HORIZON_GRADIENT_FUNC_TABLE: 743 | FZ_HORIZON_GRADIENT: 744 | TYX 745 | LDA $00a47b, x 746 | RTS 747 | GP2_HORIZON_GRADIENT: 748 | TYX 749 | LDA GP2_TRACK_HORIZON_GRADIENTS, x 750 | RTS 751 | ;========================================================= 752 | 753 | ;========================================================= 754 | ; GP2 horizon gradient values by track venue 755 | ;========================================================= 756 | GP2_TRACK_HORIZON_GRADIENTS: 757 | DB $23, $a3, $23, $a3, $23, $23, $a3, $a3, $23, $23, $a3 758 | ;========================================================= 759 | 760 | ;========================================================= 761 | ; League selction hijack tables 762 | ;========================================================= 763 | LEAGUE_SELECTION_JSR_TABLE: 764 | DW KNIGHT_LEAGUE, QUEEN_LEAGUE, KING_LEAGUE, ACE_LEAGUE 765 | 766 | LEAGUE_SELECTION_FUNC_TABLE: 767 | KNIGHT_LEAGUE: 768 | %LoadBlockToVRAM($30, SELECT_LEAGUE_SCREEN_KNIGHT_LEAGUE_TILES, $0570, $1A) 769 | RTS 770 | QUEEN_LEAGUE: 771 | %LoadBlockToVRAM($30, SELECT_LEAGUE_SCREEN_QUEEN_LEAGUE_TILES, $0570, $1A) 772 | RTS 773 | KING_LEAGUE: 774 | %LoadBlockToVRAM($30, SELECT_LEAGUE_SCREEN_KING_LEAGUE_TILES, $0570, $1A) 775 | RTS 776 | ACE_LEAGUE: 777 | %LoadBlockToVRAM($30, SELECT_LEAGUE_SCREEN_ACE_LEAGUE_TILES, $0570, $1A) 778 | RTS 779 | ;========================================================= 780 | 781 | ;========================================================= 782 | ; League selection tiles 783 | ;========================================================= 784 | SELECT_LEAGUE_SCREEN_KNIGHT_LEAGUE_TILES: 785 | DB $CC, $08, $CE, $08, $CA, $08, $C8, $08, $C9, $08, $D5, $08, $FF, $04, $CD, $08, $C6, $08, $AF, $08, $C8, $08, $D6, $08, $C6, $08 786 | 787 | SELECT_LEAGUE_SCREEN_QUEEN_LEAGUE_TILES: 788 | DB $D2, $08, $D6, $08, $C6, $08, $C6, $08, $CE, $08, $FF, $08, $CD, $08, $C6, $08, $AF, $08, $C8, $08, $D6, $08, $C6, $08, $FF, $08 789 | 790 | SELECT_LEAGUE_SCREEN_KING_LEAGUE_TILES: 791 | DB $CC, $08, $CA, $08, $CE, $08, $C8, $08, $FF, $08, $CD, $08, $C6, $08, $AF, $08, $C8, $08, $D6, $08, $C6, $08, $FF, $08, $FF, $08 792 | 793 | SELECT_LEAGUE_SCREEN_ACE_LEAGUE_TILES: 794 | DB $AF, $08, $C4, $08, $C6, $08, $FF, $08, $CD, $08, $C6, $08, $AF, $08, $C8, $08, $D6, $08, $C6, $08, $FF, $08, $FF, $08, $FF, $08 795 | 796 | SELECT_LEAGUE_CLEAR_TILES: 797 | DB $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08, $FF, $08 798 | ;========================================================= 799 | 800 | ;========================================================= 801 | ; Track horizon BG tilemap handling 802 | ;========================================================= 803 | macro LoadTrackBGxFunclet(BGx_TILEMAP_ADDR_L) 804 | TYX 805 | LDA.l ,x 806 | TAY 807 | RTS 808 | endmacro 809 | 810 | org $30E900 811 | LOAD_TRACK_BG1_JSR_TABLE: 812 | dw FZ_LOAD_TRACK_BG1, FZ_LOAD_TRACK_BG1, FZ_LOAD_TRACK_BG1, GP2_LOAD_TRACK_BG1 813 | 814 | org $30EA00 815 | LOAD_TRACK_BG1_FUNC_TABLE: 816 | FZ_LOAD_TRACK_BG1: 817 | %LoadTrackBGxFunclet(!FZ_BG1_TILEMAP_OFFSET) 818 | GP2_LOAD_TRACK_BG1: 819 | %LoadTrackBGxFunclet(!GP2_BG1_TILEMAP_OFFSET) 820 | 821 | org $30EB00 822 | LOAD_TRACK_BG2_JSR_TABLE: 823 | dw FZ_LOAD_TRACK_BG2, FZ_LOAD_TRACK_BG2, FZ_LOAD_TRACK_BG2, GP2_LOAD_TRACK_BG2 824 | 825 | org $30EC00 826 | LOAD_TRACK_BG2_FUNC_TABLE: 827 | FZ_LOAD_TRACK_BG2: 828 | %LoadTrackBGxFunclet(!FZ_BG2_TILEMAP_OFFSET) 829 | GP2_LOAD_TRACK_BG2: 830 | %LoadTrackBGxFunclet(!GP2_BG2_TILEMAP_OFFSET) 831 | 832 | ;========================================================= 833 | ; Track modifications hijack table 834 | ;========================================================= 835 | org $30ED00 836 | TRACK_MODIFICATIONS_ENABLED_TABLE: 837 | DW #$0001, #$0001, #$0001, #$0000 838 | ;========================================================= 839 | 840 | ;========================================================= 841 | ; Track graphics hijack table 842 | ;========================================================= 843 | macro TrackGFXFunclet(BANK_ADDR_B, TRACK_GFX_ADDR_L) 844 | TYX 845 | LDA , X 846 | STA $04 847 | INX 848 | LDA , X 849 | STA $05 850 | LDA # 851 | STA $06 852 | RTS 853 | endmacro 854 | 855 | org $30EE00 856 | LOAD_TRACK_GFX_JSR_TABLE: 857 | DW FZ_TRACK_GFX, FZ_TRACK_GFX, FZ_TRACK_GFX, GP2_TRACK_GFX 858 | 859 | org $30EF00 860 | LOAD_TRACK_GFX_FUNC_TABLE: 861 | FZ_TRACK_GFX: 862 | %TrackGFXFunclet($0C, !FZ_TRACK_GFX_TABLE) 863 | GP2_TRACK_GFX: 864 | %TrackGFXFunclet($1C, !GP2_TRACK_GFX_TABLE) 865 | ;========================================================= 866 | 867 | ;========================================================= 868 | ; AI Checkpoint bank table 869 | ;========================================================= 870 | org $30F200 871 | AI_CHECKPOINT_BANK_TABLE: 872 | DW $0002, $0002, $0002, $0012 873 | ;========================================================= 874 | 875 | ;========================================================= 876 | ; AI Checkpoint hijack table 877 | ;========================================================= 878 | macro AICheckpointFunclet(CHECK_POINT_ADDR_S) 879 | TYX 880 | LDA ,x 881 | RTS 882 | endmacro 883 | 884 | org $30F000 885 | AI_CHECKPOINT_JSR_TABLE: 886 | DW FZ_AI_CHECKPOINT, FZ_AI_CHECKPOINT, FZ_AI_CHECKPOINT, GP2_AI_CHECKPOINT 887 | 888 | org $30F100 889 | AI_CHECKPOINT_FUNC_TABLE: 890 | FZ_AI_CHECKPOINT: 891 | %AICheckpointFunclet(!FZ_AI_CHECKPOINT_TABLE) 892 | GP2_AI_CHECKPOINT: 893 | %AICheckpointFunclet(!GP2_AI_CHECKPOINT_TABLE) 894 | ;========================================================= 895 | 896 | ;========================================================= 897 | ; Track mines handling 898 | ;========================================================= 899 | macro TrackMinesFunclet(BANK_ADDR_S, MINE_TABLE_ADDR_L) 900 | TYX 901 | LDA # 902 | STA $21 903 | LDA ,x 904 | RTS 905 | endmacro 906 | 907 | ;Track mines hijack table 908 | org $30F400 909 | TRACK_MINES_JSR_TABLE: 910 | DW FZ_TRACK_MINES, FZ_TRACK_MINES, FZ_TRACK_MINES, GP2_TRACK_MINES 911 | 912 | org $30F500 913 | TRACK_MINES_FUNC_TABLE: 914 | FZ_TRACK_MINES: 915 | %TrackMinesFunclet($0C00, !FZ_TRACK_MINE_TABLE) 916 | GP2_TRACK_MINES: 917 | %TrackMinesFunclet($1C00, !GP2_TRACK_MINE_TABLE) 918 | ;========================================================= 919 | 920 | ;========================================================= 921 | ;Tile pool hijack table 922 | ;========================================================= 923 | macro TilePoolTableFunclet(BANK_ADDR_B, TILE_POOL_TABLE_ADDR_S) 924 | LDX # 925 | MVN $7F, 926 | RTS 927 | endmacro 928 | 929 | org $30F600 930 | TILE_POOL_JSR_TABLE: 931 | DW FZ_TILE_POOL, FZ_TILE_POOL, FZ_TILE_POOL, GP2_TILE_POOL 932 | 933 | org $30F700 934 | TILE_POOL_FUNC_TABLE: 935 | FZ_TILE_POOL: 936 | %TilePoolTableFunclet(!FZ_TILE_POOL_BANK, !FZ_TILE_POOL_ADDR) 937 | GP2_TILE_POOL: 938 | %TilePoolTableFunclet(!GP2_TILE_POOL_BANK, !FZ_TILE_POOL_ADDR) 939 | ;========================================================= 940 | 941 | ;========================================================= 942 | ;Track setting hijack table 943 | ;========================================================= 944 | macro TrackSettingTableFunclet(TRACK_SETTING_TABLE_ADDR_L) 945 | TYX 946 | LDA , X 947 | RTS 948 | endmacro 949 | 950 | org $30FA00 951 | TRACK_SETTINGS_JSR_TABLE: 952 | DW FZ_TRACK_SETTINGS, FZ_TRACK_SETTINGS, FZ_TRACK_SETTINGS, GP2_TRACK_SETTINGS 953 | 954 | org $30FB00 955 | TRACK_SETTINGS_FUNC_TABLE: 956 | FZ_TRACK_SETTINGS: 957 | %TrackSettingTableFunclet(!FZ_TRACK_SETTINGS_TABLE_ADDRESS) 958 | GP2_TRACK_SETTINGS: 959 | %TrackSettingTableFunclet(!GP2_TRACK_SETTINGS_TABLE_ADDRESS) 960 | ;========================================================= 961 | 962 | ;========================================================= 963 | ; Read org size hijacking table 964 | ;========================================================= 965 | macro ReadOrgFunclet(READ_ORG_TABLE_ADDR_L) 966 | TYX 967 | LDA ,X 968 | STA $22 969 | INX 970 | INX 971 | LDA ,X 972 | STA $26 973 | RTS 974 | endmacro 975 | 976 | org $30FC00 977 | READ_ORG_SIZE_JSR_TABLE: 978 | DW FZ_READ_ORG, FZ_READ_ORG, FZ_READ_ORG, GP2_READ_ORG 979 | 980 | org $30FD00 981 | READ_ORG_FUNC_TABLE: 982 | FZ_READ_ORG: 983 | %ReadOrgFunclet(!FZ_READ_ORG_TABLE) 984 | GP2_READ_ORG: 985 | %ReadOrgFunclet(!GP2_READ_ORG_TABLE) 986 | ;========================================================= 987 | 988 | ;========================================================= 989 | ; Bank read hijacking table 990 | ;========================================================= 991 | macro BankReadFunclet(BANK_ADDR_S, BANK_READ_TABLE_ADDR_L) 992 | TYX 993 | LDA , X 994 | CLC 995 | ADC # 996 | AND #$00FF 997 | STA $24 998 | RTS 999 | endmacro 1000 | 1001 | org $30F800 1002 | SET_READ_BANK_JSR_TABLE: 1003 | DW FZ_SET_READ_BANK, FZ_SET_READ_BANK, FZ_SET_READ_BANK, GP2_SET_READ_BANK 1004 | 1005 | org $30F900 1006 | SET_READ_BANK_FUNC_TABLE: 1007 | FZ_SET_READ_BANK: 1008 | %BankReadFunclet($0000, !FZ_TRACK_BANK_TABLE) 1009 | GP2_SET_READ_BANK: 1010 | %BankReadFunclet($0010, !GP2_TRACK_BANK_TABLE) 1011 | ;========================================================= 1012 | 1013 | ;========================================================= 1014 | ; Pallete hijacking table 1015 | ;========================================================= 1016 | macro PaletteFunclet(BANK_ADDR_B, FZ_PALETETE_TABLE_ADDR_L) 1017 | TYX 1018 | LDA , X 1019 | TAX 1020 | LDY #$0520 1021 | LDA #$00df 1022 | MVN $00, 1023 | RTS 1024 | endmacro 1025 | 1026 | org $30FE00 1027 | LOAD_PALETTE_JSR_TABLE: 1028 | DW LOAD_FZ_PALETTE, LOAD_FZ_PALETTE, LOAD_FZ_PALETTE, LOAD_GP2_PALETTE 1029 | 1030 | org $30FF00 1031 | LOAD_PALETTE_FUNC_TABLE: 1032 | LOAD_FZ_PALETTE: 1033 | %PaletteFunclet(!FZ_PALETTE_BANK, !FZ_PALETTE_TABLE_ADDRESS) 1034 | LOAD_GP2_PALETTE: 1035 | %PaletteFunclet(!GP2_PALETTE_BANK, !GP2_PALETTE_TABLE_ADDRESS) 1036 | ;========================================================= -------------------------------------------------------------------------------- /GP2_Hover_Cars.asm: -------------------------------------------------------------------------------- 1 | !PLAYER_CAR_SELECTION equ $52 2 | 3 | ; Hijack ai init, original code - LDA !Player_Car_Type, ASL A, ASL A 4 | org $00d2ef 5 | JML Hijack_Init_AI_Cars 6 | 7 | org $00fa25 8 | JML Hijack_Prestart_Accel 9 | 10 | org $00ed05 11 | JML Hijack_Draw_Car_5_Out_Of_Race 12 | 13 | ; Set_Spare_Spr_Pos 14 | org $00b193 15 | JML Hijack_Set_Spare_Spr_Pos 16 | 17 | ; Init_Misc_Race_Spr 18 | org $00a849 19 | JML Hijack_Init_Misc_Race_Spr 20 | 21 | ; Init_HUD 22 | org $00a7e6 23 | JML Hijack_Init_HUD 24 | 25 | ; Disable loading vehicles palettes in Load_Track_Pal, wait to Init_Player_Car to handle that 26 | org $00a148 27 | nop 28 | nop 29 | nop 30 | 31 | ; Disable loading vehicle palettes in Load_Track_Pal during practice 32 | org $00a171 33 | nop 34 | nop 35 | nop 36 | 37 | ;============================================================= 38 | ; DMA_Spare_Spr 39 | ;============================================================= 40 | org $0088d3 41 | JSR DMA_Spare_Spr_Redirect 42 | 43 | org $00b125 44 | DMA_Spare_Spr_FZ: 45 | 46 | org $00b163 47 | DMA_Spare_Spr_FZ_Exit: 48 | 49 | org $10af36 50 | DMA_Spare_Spr_GP2: 51 | 52 | org $10af40 53 | ora #$18 54 | 55 | org $10af74 56 | RTL 57 | ;============================================================= 58 | 59 | ;============================================================= 60 | ; Hijack Init_Player_Car 61 | ;============================================================= 62 | org $0089e4 63 | JSR Init_Player_Car_Redirect 64 | 65 | org $00b236 66 | Init_Player_Car_FZ: 67 | 68 | org $00b29b 69 | Init_Player_Car_FZ_Exit: 70 | 71 | org $10b047 72 | Init_Player_Car_GP2: 73 | 74 | org $10b0ac 75 | RTL 76 | ;============================================================= 77 | 78 | ;============================================================= 79 | ; Hijack Load_Player_Spr_Arrangement to call gp2 method 80 | ;============================================================= 81 | org $00d71d 82 | JML Hijack_Load_Player_Spr_Arrangement 83 | 84 | org $00d723 85 | Load_Player_Spr_Arrangement_FZ_Continue: 86 | 87 | org $00d850 88 | Load_Player_Spr_Arrangement_FZ_Exit: 89 | 90 | org $10d60b 91 | pea $0012 92 | 93 | org $10d758 94 | lda $120000,x 95 | 96 | org $10d737 97 | lda $120000,x 98 | 99 | org $10d73e 100 | lda $120002,x 101 | ;============================================================= 102 | 103 | ;============================================================= 104 | ; Hijack Updt_Player_Anim to point to gp2 method 105 | ;============================================================= 106 | org $008d7e 107 | JSR Updt_Player_Anim_Redirect 108 | 109 | org $00ba70` 110 | Updt_Player_Anim: 111 | 112 | org $00baae 113 | Updt_Player_Anim_Exit: 114 | ;============================================================= 115 | 116 | ;============================================================= 117 | ; Hijack Draw_All_Cars 118 | ;============================================================= 119 | org $00f33f 120 | JML Hijack_Draw_All_Cars 121 | 122 | org $00f349 123 | Draw_Player_Car_FZ_Call: 124 | 125 | org $00f34c 126 | Skip_Draw_Player_Car_FZ_Call: 127 | ;============================================================= 128 | 129 | ;============================================================= 130 | ; Hijack Upload_Player_GFX 131 | ;============================================================= 132 | org $0089ff 133 | JSR Upload_Player_GFX_Redirect 134 | 135 | org $00d20a 136 | Upload_Player_GFX_FZ: 137 | 138 | org $00d2ce 139 | Upload_Player_GFX_FZ_Exit: 140 | 141 | org $10d119 142 | adc #$18 143 | 144 | org $10d10c 145 | lda $12eee5,x 146 | 147 | org $10d12f 148 | lda $12eeec,x 149 | 150 | org $10d137 151 | lda $12eeec,x 152 | 153 | org $10d13f 154 | lda $12eeec,x 155 | 156 | org $10d176 157 | lda $12ef10,x 158 | ;============================================================= 159 | 160 | ;============================================================= 161 | ; Hijack Upload_Jump_GFX 162 | ;============================================================= 163 | org $00ebdf 164 | JSR Upload_Jump_GFX_Redirect 165 | 166 | org $00f128 167 | Upload_Jump_GFX_FZ: 168 | 169 | org $10f1c0 170 | PEA $0012 171 | 172 | org $10f1e1 173 | adc #$18 174 | 175 | org $10f104 176 | lda $12f159,x 177 | 178 | org $10f06d 179 | rts 180 | 181 | org $10f061 182 | rts 183 | 184 | org $10f022 185 | rts 186 | 187 | org $10f044 188 | lda #$001e 189 | ;============================================================= 190 | 191 | ;============================================================= 192 | ; Hijack Updt_Player_Engine_Fire 193 | ;============================================================= 194 | org $008d92 195 | JSR Updt_Player_Engine_Fire_Redirect 196 | 197 | org $00C507 198 | Updt_Player_Engine_Fire_FZ: 199 | 200 | org $00c519 201 | Updt_Player_Engine_Fire_FZ_Exit: 202 | 203 | org $008bba 204 | JSR Load_Misc_Colors_Engine_Fire_Redirect 205 | 206 | org $0089f9 207 | JSR Load_Misc_Colors_Engine_Fire_Redirect 208 | 209 | org $00BE45 210 | Load_Misc_Colors_Engine_Fire_FZ: 211 | 212 | org $00be88 213 | Load_Misc_Colors_Engine_Fire_FZ_Exit: 214 | 215 | org $10c4b8 216 | lda $12c300,x 217 | 218 | org $10c4c1 219 | lda $12c302,x 220 | 221 | org $10c4ca 222 | lda $12c304,x 223 | 224 | org $10c4d3 225 | lda $12c306,x 226 | 227 | org $10c4e7 228 | lda $12c328,x 229 | 230 | org $10c4fb 231 | lda $12c340,x 232 | 233 | org $10c504 234 | lda $12c342,x 235 | 236 | org $10c50d 237 | lda $12c344,x 238 | 239 | org $10c516 240 | lda $12c346,x 241 | 242 | org $10c52a 243 | lda $12c368,x 244 | 245 | org $10c533 246 | lda $12c36a,x 247 | 248 | org $10c53c 249 | lda $12c36c,x 250 | 251 | org $10c545 252 | lda $12c36e,x 253 | ;============================================================= 254 | 255 | ;============================================================= 256 | ; Hijack Flash_Player_Lap_Finish 257 | ;============================================================= 258 | org $008db6 259 | JSR Flash_Player_Lap_Finish_Redirect 260 | 261 | org $00C782 262 | Flash_Player_Lap_Finish_FZ: 263 | 264 | org $00c7ab 265 | Flash_Player_Lap_Finish_FZ_Exit: 266 | 267 | org $10c5f8 268 | mvn $00, $1f 269 | ;============================================================= 270 | 271 | ;============================================================= 272 | ; Hijack Updt_Player_Values 273 | ;============================================================= 274 | org $00b2a2 275 | JML Hijack_Updt_Player_Values 276 | 277 | org $10b0b7 278 | Updt_Player_Values_GP2_Methods: 279 | 280 | org $10b0d1 281 | RTL 282 | 283 | org $10b0d8 284 | RTL 285 | 286 | org $00b2c9 287 | Updt_Player_Values_FZ_Race_Ended: 288 | 289 | org $00b2c0 290 | Updt_Player_Values_FZ_Exit: 291 | 292 | org $00b2a6 293 | Updt_Player_Values_FZ_Methods: 294 | 295 | org $10b6b1 296 | lda $12c421,x 297 | 298 | org $10b6b8 299 | lda $12c46d,x 300 | 301 | org $10b700 302 | lda $12c48e,x 303 | ;============================================================= 304 | 305 | ;============================================================= 306 | ; Hijack Update_Cars_Values 307 | ;============================================================= 308 | org $00915d 309 | JML Hijack_Update_Cars_Values 310 | 311 | org $00916b 312 | Update_Cars_Values_FZ_Methods: 313 | 314 | org $00919b 315 | Update_Cars_Values_FZ_Continue: 316 | 317 | org $0091a6 318 | Update_Cars_Values_FZ_Skip: 319 | 320 | org $009166 321 | Update_Cars_Values_FZ_Move_Offscreen: 322 | 323 | org $108f36 324 | RTL 325 | 326 | org $109272 327 | lda $12c4ad,x 328 | 329 | org $10927b 330 | lda $18ed20,x 331 | 332 | org $10928f 333 | lda $18ec30,x 334 | 335 | org $1091af 336 | lda $12c50c,x 337 | ;============================================================= 338 | 339 | ;============================================================= 340 | ; GP2 Bank 00 Long jump redirects 341 | ;============================================================= 342 | org $108000 ; Who needs gp2's init code? 343 | Draw_Player_Car_GP2_L: 344 | JSR $f3d8 345 | RTL 346 | 347 | Updt_Player_Anim_GP2_L: 348 | JSR $b881 349 | RTL 350 | 351 | Load_Player_Spr_Arrangement_GP2_L: 352 | JSR $d609 353 | RTL 354 | 355 | Upload_Player_GFX_GP2_L: 356 | JSR $d0f6 357 | RTL 358 | 359 | Upload_Jump_GFX_GP2_L: 360 | JSR $f017 361 | RTL 362 | 363 | Update_Player_Engine_Fire_GP2_L: 364 | JSR $c32e 365 | RTL 366 | 367 | Load_Misc_Colors_Engine_Fire_GP2_L: 368 | JSR $bc5d 369 | RTL 370 | 371 | Flash_Player_Lap_Finish_GP2_L: 372 | JSR $c5a1 373 | RTL 374 | 375 | Do_Player_Collision_Redirect: 376 | PEA $1000 377 | PLB 378 | JSL Do_Player_Collision_L 379 | PLB 380 | RTS 381 | ;============================================================= 382 | 383 | ;============================================================= 384 | ; FZ Bank 00 redirects 385 | ;============================================================= 386 | org $008791 ; "Set_Uncont_If_Greater" (0x12 bytes of unused space, 4 hijacks worth) 387 | Updt_Player_Anim_Redirect: 388 | JML Hijack_Updt_Player_Anim 389 | 390 | Upload_Player_GFX_Redirect: 391 | JML Hijack_Upload_Player_GFX 392 | 393 | Upload_Jump_GFX_Redirect: 394 | JML Hijack_Upload_Jump_GFX 395 | 396 | Load_Misc_Colors_Engine_Fire_Redirect: 397 | JML Hijack_Load_Misc_Colors_Engine_Fire 398 | 399 | org $00977F ; "Updt_Car_Coords_Revrs" (0x3D bytes of unused space, 15 hijacks) 400 | Updt_Player_Engine_Fire_Redirect: 401 | JML Hijack_Updt_Player_Engine_Fire 402 | 403 | Flash_Player_Lap_Finish_Redirect: 404 | JML Hijack_Flash_Player_Lap_Finish 405 | 406 | Init_Player_Car_Redirect: 407 | JML Hijack_Init_Player_Car 408 | 409 | Do_Player_Collision_L: 410 | JSR Do_Player_Collision 411 | RTL 412 | 413 | DMA_Spare_Spr_Redirect: 414 | JML Hijack_DMA_Spare_Spr 415 | ;============================================================= 416 | 417 | ;============================================================= 418 | ; Load gp2 select car graphics 419 | ;============================================================= 420 | org $0385dc 421 | JML Hijack_Load_Car_Select_Screen_Car_Type 422 | 423 | org $0385b1 424 | JML Hijack_Load_Car_Select_Screen_Bank_BG2 425 | 426 | org $0385be 427 | JML Hijack_Load_Car_Select_Screen_Bank_BG1 428 | 429 | org $03864f 430 | Select_Player_Car_GM_Exit: 431 | 432 | org $0398f3 433 | JML Hijack_Load_Car_Select_GFX_Long 434 | 435 | org $038b65 436 | JML Hijack_Load_Car_Select_Screen_GFX_DMA_1 437 | 438 | org $138B6D 439 | dw $0018,$0019,$001A,$001B 440 | 441 | org $038668 442 | JML Hijack_Select_Car_Set_Index 443 | 444 | org $0388EA 445 | JML Hijack_Select_Car_Set_Car_Select_Palette 446 | 447 | org $038641 448 | JML Hijack_Select_Player_Car_GM 449 | ;============================================================= 450 | 451 | ;============================================================= 452 | ; Hijack Do_Player_Collision 453 | ;============================================================= 454 | org $00BB66 455 | Do_Player_Collision: 456 | 457 | org $10b0bc 458 | JSR Do_Player_Collision_Redirect 459 | ;============================================================= 460 | -------------------------------------------------------------------------------- /GP2_Hover_Cars_Hijacks.asm: -------------------------------------------------------------------------------- 1 | ;============================================================= 2 | ; Extra tasty macros for GP2 method calls 3 | ;============================================================= 4 | 5 | ; Stores the players car selection on the stack and masks off the GP2 car selection bit (#$10) for GP2 method calls 6 | macro Mask_Method_Pre() 7 | PHA 8 | PHP 9 | SEP #$20 10 | LDA !PLAYER_CAR_SELECTION 11 | PHA 12 | AND #$0F 13 | STA !PLAYER_CAR_SELECTION 14 | endmacro 15 | 16 | ; Restores the players car selection after a GP2 method call 17 | macro Mask_Method_Post() 18 | SEP #$20 19 | PLA 20 | STA !PLAYER_CAR_SELECTION 21 | PLP 22 | PLA 23 | endmacro 24 | 25 | ; Sets the bank for a GP2 method call in addition to masking player car selection 26 | macro GP2_Method_Pre(BANK_ADDR_S) 27 | PEA 28 | PLB 29 | %Mask_Method_Pre() 30 | endmacro 31 | 32 | ; Restores the bank and car selection after a GP2 method call 33 | macro GP2_Method_Post() 34 | %Mask_Method_Post() 35 | PLB 36 | endmacro 37 | 38 | ; Macro to select the correct method to call based on whether the player is using a GP2 vehicle 39 | macro Method_Select(TEST_VALUE, FZ_LABEL) 40 | lda !PLAYER_CAR_SELECTION 41 | bit 42 | bne .do_gp2 43 | 44 | BRA 45 | 46 | .do_gp2 47 | endmacro 48 | 49 | ; Masks the loading of !PLAYER_CAR_SELECTION 50 | macro Mask_Car_Load(MASK) 51 | LDA !PLAYER_CAR_SELECTION 52 | AND 53 | endmacro 54 | ;============================================================= 55 | 56 | ;========================================================= 57 | ; Masks the prestart accel car loading 58 | ;========================================================= 59 | Hijack_Prestart_Accel: 60 | %Mask_Car_Load(#$0F) 61 | TAX 62 | 63 | LDA $0b20 64 | 65 | JML $00fa2a 66 | ;========================================================= 67 | 68 | ;========================================================= 69 | ; Masks car loading while initializing ai vehicles 70 | ;========================================================= 71 | Hijack_Init_AI_Cars: 72 | %Mask_Car_Load(#$0F) 73 | 74 | ASL A 75 | ASL A 76 | 77 | JML $00d2f3 78 | ;========================================================= 79 | 80 | ;========================================================= 81 | ; Hijacks Init_Player_Car to load palettes for GP2/FZ vehicles, this is moved from Load_Track_Pal for convenience. 82 | ; Special handling is required for master endings as the player's car selection moves to $0F51. 83 | ;========================================================= 84 | Hijack_Init_Player_Car: 85 | JSR Load_Base_Vehicle_Palettes_FZ 86 | 87 | %Method_Select(#$10, .check_for_master_ending) 88 | 89 | LDA $58 90 | BEQ .not_practice 91 | 92 | JSR Load_Vehicle_Palette_Prep 93 | LDY #$0680 94 | MVN $00,$1F 95 | SEP #$30 96 | 97 | BRA .continue_gp2 98 | 99 | .not_practice 100 | JSR Load_GP2_Vehicle_Palette 101 | 102 | .continue_gp2 103 | %GP2_Method_Pre($0010) 104 | JSL Init_Player_Car_GP2 105 | %GP2_Method_Post() 106 | 107 | JML Init_Player_Car_FZ_Exit 108 | 109 | .check_for_master_ending 110 | LDA $0F50 111 | BEQ .do_fz_init_player_car ; If not Playing master ending, skip GP2 palette 112 | LDA $0F51 113 | BIT #$10 114 | BEQ .exit ; If master ending car is an FZ car, skip GP2 palette 115 | 116 | ; A copy of "Load_GP2_Vehicle_Palette", but a little different 117 | REP #$30 118 | LDA $0F51 119 | JSR Load_Vehicle_Palette_Prep_A 120 | MVN $00,$1F 121 | SEP #$30 122 | ; A copy of "Load_GP2_Vehicle_Palette", but a little different 123 | 124 | bra .exit 125 | 126 | .do_fz_init_player_car 127 | 128 | LDA $58 129 | BEQ .exit 130 | 131 | JSR Load_Vehicle_Palette_Prep 132 | LDY #$0680 133 | MVN $00,$0F 134 | SEP #$30 135 | 136 | .exit 137 | JML Init_Player_Car_FZ 138 | ;========================================================= 139 | 140 | ;========================================================= 141 | ; Loads the palette for the FZ car selection screen 142 | ;========================================================= 143 | Load_Car_Select_Screen_Palette_FZ: 144 | 145 | REP #$30 146 | 147 | LDA #$00fd 148 | LDX #$e102 149 | LDY #$0502 150 | MVN $00, $0e 151 | 152 | SEP #$30 153 | 154 | JSR Load_Base_Vehicle_Palettes_FZ 155 | 156 | RTS 157 | ;========================================================= 158 | 159 | ;========================================================= 160 | ; Loads the palette for the GP2 car selection screen 161 | ;========================================================= 162 | Load_Car_Select_Screen_Palette_GP2: 163 | 164 | REP #$30 165 | 166 | LDA #$00fd 167 | LDX #$e102 168 | LDY #$0502 169 | MVN $00, $1e 170 | 171 | SEP #$30 172 | 173 | JSR Load_Base_Vehicle_Palettes_GP2 174 | 175 | RTS 176 | ;========================================================= 177 | 178 | ;========================================================= 179 | ; Loads all base vehicle palettes for FZ 180 | ;========================================================= 181 | Load_Base_Vehicle_Palettes_FZ: 182 | REP #$30 183 | 184 | LDA #$00ff 185 | LDX #$cd00 186 | LDY #$0600 187 | MVN $00,$0f 188 | 189 | SEP #$30 190 | 191 | RTS 192 | ;========================================================= 193 | 194 | ;========================================================= 195 | ; Loads all base vehicle palettes for GP2 196 | ;========================================================= 197 | Load_Base_Vehicle_Palettes_GP2: 198 | REP #$30 199 | 200 | LDA #$00ff 201 | LDX #$cd00 202 | LDY #$0600 203 | MVN $00,$1f 204 | 205 | SEP #$30 206 | 207 | RTS 208 | ;========================================================= 209 | 210 | ;========================================================= 211 | ; Loads a single GP2 vehicle's palette into the players palette slot 212 | ;========================================================= 213 | Load_GP2_Vehicle_Palette: 214 | JSR Load_Vehicle_Palette_Prep 215 | 216 | MVN $00,$1f 217 | 218 | SEP #$30 219 | 220 | RTS 221 | ;========================================================= 222 | 223 | ;========================================================= 224 | ; Loads a single FZ vehicle's palette into the players palette slot 225 | ;========================================================= 226 | Load_FZ_Vehicle_Palette: 227 | JSR Load_Vehicle_Palette_Prep 228 | 229 | MVN $00,$0f 230 | 231 | SEP #$30 232 | 233 | RTS 234 | ;========================================================= 235 | 236 | ;========================================================= 237 | ; Common method for loading vehicle palettes 238 | ;========================================================= 239 | Load_Vehicle_Palette_Prep: 240 | REP #$30 241 | 242 | LDA !PLAYER_CAR_SELECTION 243 | 244 | Load_Vehicle_Palette_Prep_A: ; Receives CAR TYPE in A 245 | AND #$000f 246 | 247 | CLC 248 | ASL a ; Multiply by 32! 249 | ASL a 250 | ASL a 251 | ASL a 252 | ASL a 253 | 254 | PHA 255 | 256 | ADC #$cd80 257 | TAX 258 | 259 | PLA 260 | 261 | ADC #$0680 262 | TAY 263 | 264 | LDA #$001f 265 | 266 | RTS 267 | ;========================================================= 268 | 269 | ;========================================================= 270 | ; Mask player car selection for the rest of Draw_Car_5_Out_Of_Race 271 | ;========================================================= 272 | Hijack_Draw_Car_5_Out_Of_Race: 273 | LDA !PLAYER_CAR_SELECTION 274 | STA $113b 275 | AND #$0F 276 | 277 | JML $00ed0a 278 | ;========================================================= 279 | 280 | ;========================================================= 281 | ; Hijacks Draw_All_Cars to draw the player using the correct method 282 | ;========================================================= 283 | Hijack_Draw_All_Cars: 284 | ; Original code from $00f33f 285 | LDA $0c70 286 | STA $1a 287 | LDA $0c80 288 | STA $1c 289 | ; Original code from $00f33f 290 | 291 | %Method_Select(#$10, .do_fz_draw_player_cars) 292 | 293 | %GP2_Method_Pre($0010) 294 | JSL Draw_Player_Car_GP2_L 295 | %GP2_Method_Post() 296 | 297 | JML Skip_Draw_Player_Car_FZ_Call 298 | 299 | .do_fz_draw_player_cars 300 | JML Draw_Player_Car_FZ_Call 301 | ;========================================================= 302 | 303 | 304 | ;========================================================= 305 | ; Hijack Load_Player_Spr_Arrangement to use the correct method 306 | ;========================================================= 307 | Hijack_Load_Player_Spr_Arrangement: 308 | %Method_Select(#$0010, .do_fz_load_PLAyer_spr) 309 | 310 | %Mask_Method_Pre() 311 | JSL Load_Player_Spr_Arrangement_GP2_L 312 | %Mask_Method_Post() 313 | 314 | JML Load_Player_Spr_Arrangement_FZ_Exit 315 | 316 | .do_fz_load_PLAyer_spr 317 | ; Original code from $00D71D 318 | SEP #$30 319 | PEA $0002 320 | PLB 321 | ; Original code from $00D71D 322 | 323 | JML Load_Player_Spr_Arrangement_FZ_Continue 324 | ;========================================================= 325 | 326 | ;========================================================= 327 | ; Hijack Updt_Player_Anim to use the correct method 328 | ;========================================================= 329 | Hijack_Updt_Player_Anim: 330 | %Method_Select(#$10, .do_fz_updt_PLAyer_anim) 331 | 332 | %GP2_Method_Pre($0010) 333 | JSL Updt_Player_Anim_GP2_L 334 | %GP2_Method_Post() 335 | 336 | JML Updt_Player_Anim_Exit 337 | 338 | .do_fz_updt_PLAyer_anim 339 | JML Updt_Player_Anim 340 | ;========================================================= 341 | 342 | ;========================================================= 343 | ; Hijack Upload_Player_GFX to use the correct method 344 | ;========================================================= 345 | Hijack_Upload_Player_GFX: 346 | %Method_Select(#$10, .do_fz_upload_PLAyer_gfx) 347 | 348 | %GP2_Method_Pre($0010) 349 | JSL Upload_Player_GFX_GP2_L 350 | %GP2_Method_Post() 351 | 352 | JML Upload_Player_GFX_FZ_Exit 353 | 354 | .do_fz_upload_PLAyer_gfx 355 | JML Upload_Player_GFX_FZ 356 | ;========================================================= 357 | 358 | ;========================================================= 359 | ; Hijack Upload_Jump_GFX to use the correct method 360 | ;========================================================= 361 | Hijack_Upload_Jump_GFX: 362 | SEP #$20 363 | 364 | %Method_Select(#$10, .do_fz_upload_jump_gfx) 365 | 366 | %GP2_Method_Pre($0010) 367 | JSL Upload_Jump_GFX_GP2_L 368 | %GP2_Method_Post() 369 | 370 | JML Upload_Jump_GFX_FZ 371 | 372 | .do_fz_upload_jump_gfx 373 | JML Upload_Jump_GFX_FZ 374 | ;========================================================= 375 | 376 | ;========================================================= 377 | ; Hijack Load_Misc_Colors_Engine_Fire to use the correct method 378 | ;========================================================= 379 | Hijack_Load_Misc_Colors_Engine_Fire: 380 | %Method_Select(#$10, .do_fz_load_misc_colors) 381 | 382 | %GP2_Method_Pre($0010) 383 | JSL Load_Misc_Colors_Engine_Fire_GP2_L 384 | %GP2_Method_Post() 385 | 386 | JML Load_Misc_Colors_Engine_Fire_FZ_Exit 387 | 388 | .do_fz_load_misc_colors 389 | JML Load_Misc_Colors_Engine_Fire_FZ 390 | ;========================================================= 391 | 392 | ;========================================================= 393 | ; Hijack Update_Cars_Values to use the correct method 394 | ;========================================================= 395 | Hijack_Update_Cars_Values: 396 | ; Original code from $00915d 397 | LDA $0b00,x 398 | BPL .skip 399 | BIT #$10 400 | BEQ .continue 401 | ; Original code from $00915d 402 | 403 | JML Update_Cars_Values_FZ_Move_Offscreen 404 | 405 | .skip 406 | JML Update_Cars_Values_FZ_Skip 407 | 408 | .continue 409 | CPX #$00 410 | BNE .do_fz_update_cars 411 | 412 | %Method_Select(#$10, .do_fz_update_cars) 413 | 414 | %GP2_Method_Pre($0010) 415 | JSL $108f06 416 | %GP2_Method_Post() 417 | 418 | JML Update_Cars_Values_FZ_Continue 419 | 420 | .do_fz_update_cars 421 | JML Update_Cars_Values_FZ_Methods 422 | ;========================================================= 423 | 424 | ;========================================================= 425 | ; Hijack Updt_Player_Values to use the correct method 426 | ;========================================================= 427 | Hijack_Updt_Player_Values: 428 | 429 | LDA $c3 430 | BEQ .continue 431 | 432 | JML Updt_Player_Values_FZ_Race_Ended 433 | 434 | .continue 435 | %Method_Select(#$10, .do_fz_updt_player_values) 436 | 437 | %GP2_Method_Pre($0010) 438 | JSL Updt_Player_Values_GP2_Methods 439 | %GP2_Method_Post() 440 | 441 | JML Updt_Player_Values_FZ_Exit 442 | 443 | .do_fz_updt_player_values 444 | JML Updt_Player_Values_FZ_Methods 445 | ;========================================================= 446 | 447 | ;========================================================= 448 | ; Hijack Updt_Player_Engine_Fire to use the correct method 449 | ;========================================================= 450 | Hijack_Updt_Player_Engine_Fire: 451 | %Method_Select(#$10, .do_fz_updt_player_engine_fire) 452 | 453 | %GP2_Method_Pre($0010) 454 | JSL Update_Player_Engine_Fire_GP2_L 455 | %GP2_Method_Post() 456 | 457 | JML Updt_Player_Engine_Fire_FZ_Exit 458 | 459 | .do_fz_updt_player_engine_fire 460 | JML Updt_Player_Engine_Fire_FZ 461 | ;========================================================= 462 | 463 | ;========================================================= 464 | ; Hijack Flash_Player_Lap_Finish to use the correct method 465 | ;========================================================= 466 | Hijack_Flash_Player_Lap_Finish: 467 | %Method_Select(#$10, .do_fz_flash_player_lap) 468 | 469 | %GP2_Method_Pre($0010) 470 | JSL Flash_Player_Lap_Finish_GP2_L 471 | %GP2_Method_Post() 472 | 473 | JML Flash_Player_Lap_Finish_FZ_Exit 474 | 475 | .do_fz_flash_player_lap 476 | JML Flash_Player_Lap_Finish_FZ 477 | ;========================================================= 478 | 479 | ;========================================================= 480 | ; Hijack Select_Car_Set_Index to load the correct car selection screen palette 481 | ;========================================================= 482 | Hijack_Select_Car_Set_Index: 483 | STX $5a 484 | LDA $03867b,x 485 | 486 | PHA 487 | 488 | %Method_Select(#$10, .is_fz) 489 | 490 | PLA 491 | ORA #$10 492 | STA !PLAYER_CAR_SELECTION 493 | 494 | JSR Load_Car_Select_Screen_Palette_GP2 495 | 496 | BRA .exit 497 | 498 | .is_fz 499 | PLA 500 | STA !PLAYER_CAR_SELECTION 501 | 502 | JSR Load_Car_Select_Screen_Palette_FZ 503 | 504 | .exit 505 | SEP #$30 506 | 507 | JML $038670 508 | ;========================================================= 509 | 510 | ;========================================================= 511 | ; Hijack Select_Car_Set_Car to load the correct car selection screen palette 512 | ;========================================================= 513 | Hijack_Select_Car_Set_Car_Select_Palette: 514 | 515 | LDA !PLAYER_CAR_SELECTION 516 | PHA 517 | 518 | BIT #$10 519 | BEQ .load_fz_palette 520 | 521 | JSR Load_Car_Select_Screen_Palette_GP2 522 | 523 | BRA .continue 524 | 525 | .load_fz_palette 526 | JSR Load_Car_Select_Screen_Palette_FZ 527 | 528 | .continue 529 | PLA 530 | 531 | PHX 532 | 533 | TAX 534 | 535 | AND #$0F 536 | STA !PLAYER_CAR_SELECTION 537 | 538 | ; Original code from $0388EA 539 | LDA !PLAYER_CAR_SELECTION 540 | ASL A 541 | ADC !PLAYER_CAR_SELECTION 542 | ASL A 543 | ; Original code from $0388EA 544 | 545 | STX !PLAYER_CAR_SELECTION 546 | 547 | PLX 548 | 549 | JML $0388f0 550 | ;========================================================= 551 | 552 | ;========================================================= 553 | ; Hijack Select_Player_Car_GM to handle R or L being clicked and reload the screen with the other set of vehicles 554 | ;========================================================= 555 | Hijack_Select_Player_Car_GM: 556 | 557 | LDA $68 558 | BIT #$20 559 | BEQ .not_select 560 | 561 | JML $038650 562 | 563 | .not_select 564 | LDA $67 565 | BIT #$30 566 | BNE .l_or_r_clicked 567 | 568 | LDA $68 569 | JML $038647 570 | 571 | .l_or_r_clicked 572 | LDA !PLAYER_CAR_SELECTION 573 | EOR #$10 574 | STA !PLAYER_CAR_SELECTION 575 | 576 | LDA #$02 577 | STA $60 578 | 579 | STZ $55 580 | 581 | LDX $5a 582 | JML Select_Player_Car_GM_Exit 583 | ;========================================================= 584 | 585 | ;========================================================= 586 | ; Hijack Load_Car_Select_Screen_Car_Type to mask player car selection 587 | ;========================================================= 588 | Hijack_Load_Car_Select_Screen_Car_Type: 589 | LDA !PLAYER_CAR_SELECTION 590 | AND #$0F 591 | TAX 592 | 593 | LDA $03867b,x 594 | 595 | JML $0385e2 596 | ;========================================================= 597 | 598 | ;========================================================= 599 | ; Hijack Load_Car_Select_Screen_Bank to set the correct bank for BG2 load 600 | ;========================================================= 601 | Hijack_Load_Car_Select_Screen_Bank_BG2: 602 | %Method_Select(#$0010, .do_fz_bank) 603 | 604 | LDA #$001f 605 | 606 | BRA .exit 607 | 608 | .do_fz_bank 609 | LDA #$000f 610 | 611 | .exit 612 | LDX #$32b0 613 | 614 | JML $0385b7 615 | ;========================================================= 616 | 617 | ;========================================================= 618 | ; Hijack Load_Car_Select_Screen_Bank to set the correct bank for BG1 load 619 | ;========================================================= 620 | Hijack_Load_Car_Select_Screen_Bank_BG1: 621 | %Method_Select(#$0010, .do_fz_bank) 622 | 623 | LDA #$001f 624 | 625 | BRA .exit 626 | 627 | .do_fz_bank 628 | LDA #$000f 629 | 630 | .exit 631 | LDX #$38b0 632 | 633 | JML $0385c4 634 | ;========================================================= 635 | 636 | ;========================================================= 637 | ; Hijack Load_Car_Select_GFX to set the correct bank for car select GFX loading 638 | ;========================================================= 639 | Hijack_Load_Car_Select_GFX_Long: 640 | %Method_Select(#$10, .do_fz_load_gfx) 641 | 642 | PEA $001e 643 | 644 | BRA .exit 645 | 646 | .do_fz_load_gfx 647 | PEA $000e 648 | 649 | .exit 650 | plb 651 | 652 | JML $0398f7 653 | ;========================================================= 654 | 655 | ;========================================================= 656 | ; Hijack Load_Car_Select_Screen_GFX to do the proper MVN 657 | ;========================================================= 658 | Hijack_Load_Car_Select_Screen_GFX_DMA_1: 659 | %Method_Select(#$0010, .do_fz_dma_1) 660 | 661 | LDA #$001f 662 | LDX #$8b5d 663 | LDY #$0ae0 664 | MVN $00, $13 665 | 666 | BRA .exit 667 | 668 | .do_fz_dma_1 669 | LDA #$001f 670 | LDX #$8b95 671 | LDY #$0ae0 672 | MVN $00, $03 673 | 674 | .exit 675 | JML $038b71 676 | ;========================================================= 677 | 678 | ;========================================================= 679 | ; Hijack Init_HUD to mask player car selection 680 | ;========================================================= 681 | Hijack_Init_HUD: 682 | TXY 683 | 684 | %Mask_Car_Load(#$0F) 685 | TAX 686 | 687 | LDA $00a803,x 688 | 689 | TYX 690 | 691 | JML $00a7eb 692 | ;========================================================= 693 | 694 | ;========================================================= 695 | ; Method to mask the car selection when loading the Spare_Sprite 696 | ;========================================================= 697 | Set_Spare_Sprite_Sub: 698 | TXY 699 | 700 | %Mask_Car_Load(#$0F) 701 | TAX 702 | 703 | LDA $00a852,x 704 | 705 | TYX 706 | 707 | RTS 708 | ;========================================================= 709 | 710 | ;========================================================= 711 | ; Hijack Init_Misc_Race_Spr to mask player car selection 712 | ;========================================================= 713 | Hijack_Init_Misc_Race_Spr: 714 | JSR Set_Spare_Sprite_Sub 715 | 716 | JML $00a84e 717 | ;========================================================= 718 | 719 | ;========================================================= 720 | ; Hijack Set_Spare_Spr_Pos to mask player car selection 721 | ;========================================================= 722 | Hijack_Set_Spare_Spr_Pos: 723 | JSR Set_Spare_Sprite_Sub 724 | 725 | JML $00b198 726 | ;========================================================= 727 | 728 | ;========================================================= 729 | ; Hijack DMA_Spare_Spr to load the correct spare sprite graphics 730 | ;========================================================= 731 | Hijack_DMA_Spare_Spr: 732 | %Method_Select(#$0010, .do_fz_dma_spare) 733 | 734 | %GP2_Method_Pre($0010) 735 | JSL DMA_Spare_Spr_GP2 736 | %GP2_Method_Post() 737 | 738 | JML DMA_Spare_Spr_FZ_Exit 739 | 740 | .do_fz_dma_spare 741 | 742 | JML DMA_Spare_Spr_FZ 743 | ;========================================================= 744 | -------------------------------------------------------------------------------- /GP2_Top_Down_Cars.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/originalgrego/FZeroFinal/20afa94bc0f112a2b161c7d9bc6b05c0e62af4dc/GP2_Top_Down_Cars.bin -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /LoadBlockToVRAM.asm: -------------------------------------------------------------------------------- 1 | ;============================================================================ 2 | ; Author: bazz 3 | ; Borrowed from: https://wiki.superfamicom.org/working-with-vram-initializing-tiles-and-tile-maps 4 | ;============================================================================ 5 | 6 | ;============================================================================ 7 | ; LoadBlockToVRAM -- Macro that simplifies calling LoadVRAM to copy data to VRAM 8 | ;---------------------------------------------------------------------------- 9 | ; In: SRC_ADDR -- 24 bit address of source data 10 | ; DEST -- VRAM address to write to (WORD address!!) 11 | ; SIZE -- number of BYTEs to copy 12 | ;---------------------------------------------------------------------------- 13 | ; Out: None 14 | ;---------------------------------------------------------------------------- 15 | ; Modifies: A, X, Y 16 | ;---------------------------------------------------------------------------- 17 | 18 | ;============================================================================ 19 | ;LoadBlockToVRAM SRC_ADDRESS, DEST, SIZE 20 | ; requires: mem/A = 8 bit, X/Y = 16 bit 21 | ;============================================================================ 22 | macro LoadBlockToVRAM(SRC_ADDR_BANK, SRC_ADDR, DEST, SIZE) 23 | ldx.w # ; DEST 24 | stx $2116 ; $2116: Word address for accessing VRAM. 25 | lda.b # ; SRCBANK 26 | ldx.w # ; SRCOFFSET 27 | ldy.w # ; SIZE 28 | jsr LoadVRAM 29 | endmacro 30 | ;============================================================================ 31 | 32 | ;============================================================================ 33 | ; LoadVRAM -- Load data into VRAM 34 | ;---------------------------------------------------------------------------- 35 | ; In: A:X -- points to the data 36 | ; Y -- Number of bytes to copy (0 to 65535) (assumes 16-bit index) 37 | ;---------------------------------------------------------------------------- 38 | ; Out: None 39 | ;---------------------------------------------------------------------------- 40 | ; Modifies: none 41 | ;---------------------------------------------------------------------------- 42 | ; Notes: Assumes VRAM address has been previously set!! 43 | ;---------------------------------------------------------------------------- 44 | LoadVRAM: 45 | pha 46 | phx 47 | phy 48 | phb 49 | php ;Preserve registers 50 | 51 | sep #$20 ;Careful not to SEP $10, or it will erase upper half of Y! 52 | 53 | stz $420B ;Clear the DMA control register 54 | stx $4302 ;Store the data offset into DMA source offset 55 | sty $4305 ;Store the size of the data block 56 | sta $4304 ;Store the data bank of the source data 57 | 58 | lda #$80 59 | sta $2115 ;set VRAM transfer mode to word-access, increment by 1 60 | 61 | lda #$01 ;Set the DMA mode (word, normal increment) 62 | sta $4300 63 | lda #$18 ;Set the destination register (VRAM gate) 64 | sta $4301 65 | lda #$01 ;Initiate the DMA transfer 66 | sta $420B 67 | 68 | plp ;Restore registers 69 | plb 70 | ply 71 | plx 72 | pla 73 | rts ;Return to caller 74 | ;============================================================================ 75 | -------------------------------------------------------------------------------- /Master_Ending.asm: -------------------------------------------------------------------------------- 1 | ;========================================= 2 | org $0396F3 3 | Load_Top_Down_Cars_GFX: 4 | PHP 5 | SEP #$20 6 | LDA $0F51 ; Player car type (Master Ending, $52 is now zero -- WILL NOT NEED TO BE 00 AFTER WE'VE DONE CHECKPOINT ROUTING INSTEAD OF PLAYBACK INPUTS!) 7 | BIT #$10 8 | BEQ .FZ_top_down_GFX 9 | 10 | JSL GP2_Load_Top_Down_Cars_GFX 11 | PLP 12 | RTS 13 | 14 | .FZ_top_down_GFX 15 | JSL FZ_Load_Top_Down_Cars_GFX 16 | PLP 17 | RTS 18 | ;========================================= 19 | -------------------------------------------------------------------------------- /Master_Ending_Hijacks.asm: -------------------------------------------------------------------------------- 1 | ;========================================= 2 | ;========================================= 3 | FZ_Load_Top_Down_Cars_GFX: 4 | LDA #$80 5 | STA $2115 6 | REP #$30 7 | LDA #$5000 8 | STA $2116 9 | LDY #$0140 10 | LDX #$0000 11 | - LDA.l $02CB80,x ; Where top down FZ cars graphics are stored 12 | STA $2118 13 | INX 14 | INX 15 | DEY 16 | BPL - 17 | SEP #$20 18 | STZ $52 ; Needed so playback goes correctly 19 | RTL 20 | ;========================================= 21 | 22 | ;========================================= 23 | ;========================================= 24 | GP2_Load_Top_Down_Cars_GFX: 25 | LDA $0F51 26 | AND #$0F 27 | STA $0F51 28 | 29 | LDA #$80 30 | STA $2115 31 | REP #$30 32 | LDA #$5000 33 | STA $2116 34 | LDY #$0140 35 | LDX #$0000 36 | - LDA.l Top_Down_GP2_Cars_GFX,x 37 | STA $2118 38 | INX 39 | INX 40 | DEY 41 | BPL - 42 | RTL 43 | ;========================================= 44 | -------------------------------------------------------------------------------- /PUT XKAS V0.06 HERE.txt: -------------------------------------------------------------------------------- 1 | You will need to obtain a copy of XKAS v0.06 and place it in the project directory. 2 | 3 | RHDN: 4 | 5 | https://www.romhacking.net/utilities/269/ 6 | 7 | SMWCentral: 8 | 9 | https://www.smwcentral.net/?p=section&a=details&id=4615 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Hello and welcome to F-Zero Final v0.2! 2 | 3 | Introduction: 4 | 5 | F-Zero Final is a mod that brings all of the content from BS F-Zero Grand Prix 2 into the original F-Zero and enhances F-Zero to handle custom maps/leagues/backgrounds/palettes etc. These changes lay the foundation for a level editor currently in development code named "FZEdit". 6 | 7 | New to version 0.2 is the ability to select the Grand Prix 2 vehicles (Press L or R during vehicle selection), complete with master mode endings for the original three leagues! 8 | 9 | Legal: 10 | 11 | This project is a collaboration between authors Gregory Lewandowski (Grego) and Richard Bukor (CatadorDeLatas). 12 | 13 | Grand Prix 2 Master Ending Graphics were contributed by Alejandro 14 | 15 | It is distributed under GNU General Public License v3: https://www.gnu.org/licenses/gpl-3.0.html 16 | 17 | Please do not distribute this work without providing all source code and attribution as required. 18 | 19 | Installation: 20 | 21 | To apply the patch please place your F-Zero USA (CRC32 - 0xAA0E31DE) and Grand Prix 2 (CRC32 - 0xC4808858) roms (legally obtained of course) into a folder named SNES_ROMS exactly one directory up from the F-Zero Final project folder. 22 | 23 | The folder structure should look as so on windows: 24 | 25 | C:\Users\You\Directory\SNES_ROMS <- ROMs go here 26 | C:\Users\You\Directory\F-Zero_Final <- Code and xkas.exe goes here 27 | 28 | Your roms will need to be named F-Zero.sfc and F-Zero_Grand_Prix_2.sfc (or you will need to modify the projects batch files and source to handle your naming convention). 29 | 30 | PLEASE MAKE SURE YOUR ROMS ARE NAMED PROPERLY! See FAQ/Help below. 31 | 32 | Download XKAS v0.06 and place it in the project directory: 33 | 34 | https://www.smwcentral.net/?p=section&a=details&id=4615 35 | 36 | Running apply_patch.bat or .sh will apply the patch using XKAS v0.06. This process is non-destructive and will create a new rom file named F-Zero_Final.sfc. 37 | 38 | If you are building on linux a recent version of Wine is required, you will also need to add the execute permission to the shell file: 39 | 40 | chmod +x ./apply_patch.sh 41 | 42 | Bugs Fixed in v0.2: 43 | 44 | * SRAM records are incorrectly handled 45 | * Mute city iv has an incorrect horizon gradient 46 | 47 | Enhancements to v0.1: 48 | 49 | * Expanded SRAM and fixed records handling for GP2/custom leagues 50 | * Horizon gradients are configurable by league 51 | * All course times are properly stored in SRAM 52 | * Added Grand Prix 2 vehicles to the roster 53 | * GP2 vehicles have custom master mode ending graphics 54 | 55 | Known Bugs: 56 | 57 | * Track shortcut routines ignored for ace league 58 | * "Ghost" shows up in the menu when using GP2 vehicles in practice but is not selectable 59 | 60 | TODO: 61 | 62 | * Integration with FZEdit for custom leagues/maps 63 | * Rewrite shortcut routines to use scalable algorithm, allowing for custom leagues 64 | * Make master mode endings work for Ace/Custom leagues 65 | * Implement configurable shortcut routines 66 | * Implement configurable explosive car chance tables 67 | * Fix records screen to handle all leagues 68 | * Fix alignment of hijack tables to allow for additional entries for custom leagues (partially done) 69 | * Split Grand Prix 2 rom to remove unnecessary ghost data (last 512k of gp2 is useless) 70 | * Improve documentation 71 | 72 | ?-----------------? FAQ/Help ?-----------------? 73 | 74 | Common problems you may experience during installation include: 75 | 76 | Incorrect directory structure - Please see above explanation of directory structure. 77 | 78 | Incorrect ROM files - Please make sure you are using F-Zero USA (CRC32 - 0xAA0E31DE) and Grand Prix 2 (CRC32 - 0xC4808858) 79 | 80 | Incorrect file names - To verify your roms have the correct name and file extension in Windows you will need to: 81 | 82 | 1.) Open a command prompt, type "cmd" into the run textbox in your start bar and hit enter 83 | 2.) Type "cd C:\Users\You\Directory\SNES_ROMS" into the command prompt and hit enter, this will take you to your SNES_ROMS directory 84 | 3.) Type "dir" and hit enter, showing you the files in the directory 85 | 86 | Alternatively you can do this through the file explorer, in Windows 7 this is done as so: 87 | 88 | 1.) Click the "Organize" drop down in the upper left corner of the file explorer window, choose "Folder and search options" 89 | 2.) Click the "View" tab and uncheck the "Hide extensions for known file types" checkbox 90 | 3.) Click apply and close the menu 91 | 92 | ?-----------------? FAQ/Help ?-----------------? 93 | -------------------------------------------------------------------------------- /SRAM_Fix.asm: -------------------------------------------------------------------------------- 1 | ;================================== 2 | ; SRAM fixes for F-Zero Final, expands the SRAM so that more leagues and tracks can be supported. 3 | ; Also modifies how SRAM address offsets are calculated, the original game used a table of addresses, now 4 | ; a calculation is done to determine offset. Finally, the SRAM mirror that was stored in system ram was disabled, 5 | ; all SRAM modifications are now made directly to SRAM. 6 | ;================================== 7 | 8 | !SRAM_OFFSET equ $0EED 9 | !MASTER_UNLOCK_BITS equ $70FFFA 10 | 11 | ;================================== 12 | ; Expand the SRAM 13 | org $00FFD8 14 | DB $04 15 | 16 | ;================================== 17 | ; SRAM now ends at $701000 instead of $700200 18 | org $02C4E0 19 | LDX #$0FFF 20 | 21 | ;================================== 22 | ; Hijack the "SRAM init" routine so it doesn't 23 | ; check for corrupted checksums or copy the 24 | ; whole $700000 SRAM to "SRAM_Buffer" ($7F4800) 25 | org $02C4B9 26 | SRAM_Init_Hijack: 27 | CMP #$02 28 | BEQ .all_good 29 | JSR Reset_SRAM ; SRAM is corrupted (was not initialized yet), reset it 30 | .all_good 31 | PLP 32 | RTL 33 | 34 | ;================================== 35 | ; Hijack the "reset SRAM" routine 36 | org $02C588 37 | LDX #$0005 38 | JSR Reset_SRAM 39 | LDA #$00 40 | STA !MASTER_UNLOCK_BITS 41 | RTS 42 | 43 | org $02C508 ; Previously a "reset SRAM" routine, now freespace 44 | Reset_SRAM: 45 | LDX #$0005 46 | LDY.w #55*10 ; Clear space reserved for 10 leagues! 47 | - LDA #$09 48 | STA $700000,x 49 | INX 50 | LDA #$59 51 | STA $700000,x 52 | INX 53 | LDA #$99 54 | STA $700000,x 55 | INX 56 | DEY 57 | BNE - 58 | RTS 59 | 60 | ;================================== 61 | ; Make "Save_Cup_SRAM" now just an RTS, since "SRAM_Buffer" is not used anymore 62 | org $02C5C1 63 | RTS 64 | 65 | ;================================== 66 | ; Access SRAM directly instead of 67 | ; using the "SRAM_Buffer" ($7F4800) 68 | org $00AB52 69 | LDA $700000,x 70 | org $00AB5C 71 | LDA $700001,x 72 | org $00AB66 73 | LDA $700002,x 74 | 75 | org $00CF9A 76 | LDA $700000,x 77 | org $00CFA0 78 | LDA $700001,x 79 | org $00CFA6 80 | LDA $700002,x 81 | 82 | org $02C3A6 83 | LDA $700000,x 84 | org $02C3B8 85 | CMP $700001,x 86 | org $02C3C1 87 | CMP $700002,x 88 | 89 | org $02C439 90 | LDA $700000,x 91 | STA $700003,x 92 | 93 | org $02C44B 94 | STA $700000,x 95 | org $02C452 96 | STA $700001,x 97 | org $02C459 98 | STA $700002,x 99 | 100 | org $02C46A 101 | STA $700000,x 102 | org $02C471 103 | STA $700001,x 104 | org $02C478 105 | STA $700002,x 106 | 107 | org $02C5A9 108 | STA $700000,x 109 | org $02C5B0 110 | STA $700000,x 111 | org $02C5B7 112 | STA $700000,x 113 | 114 | ; SEE BELOW FOR $038216 115 | ; SEE BELOW FOR $03824D 116 | ; SEE BELOW FOR $038313 117 | ; SEE BELOW FOR $038337 118 | ; SEE BELOW FOR $03834F 119 | 120 | org $0387EB 121 | LDA !MASTER_UNLOCK_BITS 122 | 123 | org $038E77 124 | LDA $700000,x 125 | org $038E7E 126 | LDA $700000,x 127 | 128 | org $038E94 129 | LDA $700000,x 130 | org $038E9D 131 | LDA $700001,x 132 | org $038EA7 133 | LDA $700002,x 134 | 135 | org $038F6B 136 | LDA $700000,x 137 | 138 | org $039BE8 139 | LDA !MASTER_UNLOCK_BITS 140 | org $039BF1 141 | ORA $039C0D,x 142 | BRA $0C ; Same as a whole lot of NOPs (STILL NEED TO VERIFY IF THIS IS CORRECT, LUL) 143 | 144 | ;================================== 145 | ; Don't need to call "Save_Cup_SRAM" anymore... 146 | org $02C3C9 147 | BRA $01 ; NOP*3, previously JSR $C5C1 148 | 149 | org $02C422 150 | BRA $01 ; NOP*3, previously JSR $C5C1 151 | 152 | ;================================== 153 | ; Use a new routine to calculate the SRAM offset of a track 154 | org $02C332 155 | JSL Set_SRAM_Offset 156 | PLP 157 | RTL 158 | 159 | org $02C3D2 160 | LDX !SRAM_OFFSET 161 | 162 | org $02C5A1 163 | LDX !SRAM_OFFSET 164 | 165 | org $038244 166 | Load_Records_Screen: 167 | JSR Hijack_Get_First_Track_Record 168 | STA $F2 169 | BRA .skip_shit 170 | org $038259 171 | .skip_shit 172 | 173 | org $03830C 174 | Get_Valid_Records_Upper_Option: 175 | TAY 176 | JSR Get_Record_Existance_For_Track 177 | BPL .try_next_track 178 | RTS 179 | org $038301 180 | .try_next_track 181 | 182 | org $038330 183 | Get_Valid_Records_Lower_Option: 184 | TAY 185 | JSR Get_Record_Existance_For_Track 186 | BPL .try_next_track 187 | RTS 188 | org $038320 189 | .try_next_track 190 | 191 | org $038348 192 | Set_Records_Option_If_Valid: 193 | TAY 194 | JSR Get_Record_Existance_For_Track 195 | BRA .skip_shit 196 | org $038355 197 | .skip_shit 198 | 199 | org $038CB6 200 | JSR Hijack_Load_Records_Menu 201 | BRA $02 ; NOP*4 202 | 203 | ;================================== 204 | ; Use an additive method to get the SRAM offset for 205 | ; each track, instead of using a table of 15 entries 206 | org $03820B 207 | JSR Hijack_Get_First_Track_Record ; JSR since there's enough freespace in bank 03 208 | RTS 209 | 210 | ;================================== 211 | ; In: 212 | ; X - League number 213 | ; Y - Track number 214 | ; Out: 215 | ; A/X - SRAM offset 216 | ;================================== 217 | org $02C5C1 ; Old "Copy buffer to SRAM" routine, now unused since accesses are made directly to SRAM 218 | Get_SRAM_Offset: 219 | REP #$10 220 | PHY 221 | SEP #$10 ; \ Clear high byte from indexes 222 | REP #$30 ; / (YEP! That's a thing from the 65816!) 223 | LDA #$0005 ; Start at offset 0005 because of the SRAM header 224 | CLC ; CLC only here since this should be impossible to roll over from 0xFFFF -> 0x0000 225 | .loop_league 226 | DEX 227 | BMI .loop_track 228 | ADC.w #33*5 229 | BRA .loop_league 230 | .loop_track 231 | DEY 232 | BMI .ret 233 | ADC.w #33 234 | BRA .loop_track 235 | .ret 236 | TAX 237 | PLY 238 | RTL 239 | 240 | Set_SRAM_Offset: 241 | LDA $58 242 | BNE .practice_mode 243 | LDY $53 244 | LDX $90 245 | BRA .get_and_set_offset 246 | 247 | .practice_mode 248 | LDX #$00 249 | LDA $53 250 | %Divide($05) 251 | TAY ; Track number in Y (remainder of division) 252 | TXA ; League number in X (quotient of division) 253 | .get_and_set_offset 254 | JSL Get_SRAM_Offset ; Use the new "Get_SRAM_Offset" routine 255 | STX !SRAM_OFFSET 256 | RTL 257 | 258 | ;================================== 259 | ; New routines in freespace 260 | ;================================== 261 | ; Gets the first track where there is a record 262 | org $039E80 263 | Hijack_Get_First_Track_Record: 264 | PHP 265 | REP #$10 266 | LDX #$0005 267 | LDY #$0000 268 | - SEP #$20 269 | LDA $700000,x ; $038216 270 | BMI .found_record 271 | REP #$20 272 | INY 273 | CPY.w #20 ; Last track index 274 | BCS .found_record 275 | TXA 276 | CLC 277 | ADC.w #33 278 | TAX 279 | BRA - 280 | .found_record 281 | TYA 282 | PLP 283 | RTS 284 | 285 | ;================================== 286 | ; Modify the "Load_Records_Menu" routine 287 | Hijack_Load_Records_Menu: 288 | PHY 289 | TYA 290 | LSR A 291 | TAY 292 | LDX #$0000 293 | JSL Get_SRAM_Offset 294 | PLY 295 | DEX 296 | LDA $700000,x 297 | RTS 298 | 299 | ;================================== 300 | ; Find out if a record exists for a track 301 | ; 302 | ; In: 303 | ; Y - Track number 304 | ;================================== 305 | Get_Record_Existance_For_Track: 306 | LDX #$00 307 | JSL Get_SRAM_Offset 308 | SEP #$20 309 | LDA $700000,x ; $03834F 310 | SEP #$10 311 | RTS 312 | -------------------------------------------------------------------------------- /apply_patch.bat: -------------------------------------------------------------------------------- 1 | SET ROM_DIR=..\SNES_ROMS 2 | 3 | del "%ROM_DIR%\F-Zero_Final.sfc" 4 | 5 | copy "%ROM_DIR%\F-Zero.sfc" "%ROM_DIR%\F-Zero_Final.sfc" 6 | 7 | xkas.exe F-Zero_Final.asm "%ROM_DIR%\F-Zero_Final.sfc" 8 | -------------------------------------------------------------------------------- /apply_patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | wineconsole apply_patch.bat 3 | 4 | -------------------------------------------------------------------------------- /master_images/Blue Thunder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/originalgrego/FZeroFinal/20afa94bc0f112a2b161c7d9bc6b05c0e62af4dc/master_images/Blue Thunder.png -------------------------------------------------------------------------------- /master_images/Fire Scorpion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/originalgrego/FZeroFinal/20afa94bc0f112a2b161c7d9bc6b05c0e62af4dc/master_images/Fire Scorpion.png -------------------------------------------------------------------------------- /master_images/Green Amazone (top part unused).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/originalgrego/FZeroFinal/20afa94bc0f112a2b161c7d9bc6b05c0e62af4dc/master_images/Green Amazone (top part unused).png -------------------------------------------------------------------------------- /master_images/Luna Bomber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/originalgrego/FZeroFinal/20afa94bc0f112a2b161c7d9bc6b05c0e62af4dc/master_images/Luna Bomber.png --------------------------------------------------------------------------------