November 21, 2024, 12:40:20 PM

Author Topic: External playbook editor  (Read 74466 times)

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #75 on: December 23, 2016, 08:26:52 AM »
awesome! Just wanted to let you know I did get your email, I might not be able to check it out for a few days though due to the holidays. Thanks for sending me it!

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #76 on: December 23, 2016, 10:40:49 AM »
No problem at all. It is probably going to take a while to figure out how to get the hack to turn on custom playbooks w/out the pin.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #77 on: December 29, 2016, 05:12:36 PM »
Made some good progress over the last few days! I was able to get the "use team plays" to load up whatever the first playbook is in the ROM perfectly. As soon as you input the cheat, it loads the first book with no issues. However, the logic to check to see if another playbook is in rom is not quite right, so it doesn't try and load up the other playbooks data. Unfortunately the addresses where I'm sticking all this new code is run dry... and that's only for the first player's code (Which means in total it will need 4 times the space). It is a pretty brute force way of checking and loading data though, so I maybe able to shorten it so that all the code can fit in one area. Below are the notes for the code as is. Some of the logic is still not right, but figured I would post it here if you were interested anyway.

Code: [Select]
//loading play notes //
//80250DEC ---> BEGINNING OFLOADING CUSTOM PLAY
//A0 --> keeps track of which plaer it is entering pin (0x0 - 0x3)

//custom cheat notes -- replacing use team plays with custom play toggle

in ROM version D_4books.z64 -- book1 @ fddfa0 "AAAAA"|||| book2 @ fdf320 "YAXETY"|||| book3 @ fe06a0 "SEXONT"|||| fe1a20 "WEATHE" // INCREASED 150C40 TO A32 --> INCLUDES ALL BOOKS
/* registers of interest
S3 - what cheat (0x22 for use team plays)
A3 - tracks what player inputted cheat (0x0 - 0x03)
T1 - INCEASE + 1 FOR FINDING CORRECT PLAYER
T2 - INCREASE + 1 WHEN LOADING IN PLAYBOOKS
T3 - CURRENT PLAYBOOK NUMBER
V0 - location of playbook to be loaded IN rom
S8 - location of player data to be written - P1 = 0x802ADF20; p2 = 0x802AF298; p3 = 0x802B0610; p4 = 0x802B1988
V1 - end of playbook to be loaded
T6 - first bit of playbook loaded
T7 - second bit of playbook loaded
S7 - 3rd bit
T8 - 4th bit
EMPTY REGS YOU CAN USE: V0,V1, T1,T2,T3,T6,T7,S4,S7,T8,S8
psedocode
1. start in use team plays
2. watch for it to be triggered
3. figure out which player it was that triggered it
4. load in playbook based on a variable X1
5. increase X1 + 1
6. if X1 = 3, reset X1 = 0
7. clear all regs back to orginal for custom cheats
8. jump back to original team plays cheat J $0024BBA4
*/
// LIST OF ADDRESSES AND WHAT THEY WILL BE USED FOR --between image table and custom play data//
0x800AE330 //boolean for if custom plays are loaded or not - 0 == no custom plays; 1 = custom plays ; 00071ae8 in branches
0x800AE334 //variable for P1 monitoring which playbook is loaded; 0 = no playbook loaded; 1 = playbook 1; 2 = plabook 2; 3 = playbook 4
0x800AE338 //variable for P2 monitoring which playbook is loaded; 0 = no playbook loaded; 1 = playbook 1; 2 = plabook 2; 3 = playbook 4
0x800AE33c //variable for P3 monitoring which playbook is loaded; 0 = no playbook loaded; 1 = playbook 1; 2 = plabook 2; 3 = playbook 4
0x800AE340 //variable for P4 monitoring which playbook is loaded; 0 = no playbook loaded; 1 = playbook 1; 2 = plabook 2; 3 = playbook 4

//part 0 - skip all this if it's a different cheat
0x71988 addiu s4,s4,$0022 //load 22 into s4 (22 = use team plays reg value)
0x7198C bne s4,s3, $00071ae8 //check to see if it's the "use team plays" cheat; branch to jump out (0x71AE8) if not
0x71990 SW R0, $0014(sp) //from original code
0x71994 SUB s4,s4,s4 //clear s4
0x71998 SW V1, $0000(T0) //store 0 into UTP address to turn it off
0x7199C SUB v0,v0,v0 //clear V0
// part 1 - check to see if custom playbooks are even in the ROM
0x719a0 LUI S4, $800B //this part looks to see if custom plays are even in the ROM. Branch to custom code if not; 800BE000 IS ACTUALLY 800AE000
ADDIU s4, s4, $E330 //load address to monitor which playbook is loaded here /// 0xfddf90 IN ROM
LW T2, 0X0000(s4) //load value at 800BE300 into T2
BGTZ T2, $00071ae8 //Is there a custom play loaded? If so, T2 should be > 0 and it won't branch. If == 0, it will branch
nop
sub s4,s4,s4
sub t2,t2,t2

// part 2 - check to see what player is trying to load custom playbook
0x719bc BNE A3, T1 $00071XXX //are you P1? if not, branch
nop
// part 2.1 - load player 1 custom playbook 1
LUI S4, $800B
ADDIU s4, s4, $E334 //load address to monitor which playbook is loaded here
LW T2, $0000(s4) //load value at 800BF000 into T2
0x719d0 BNE T2, T3 $YY1 //has playbook 1 already loaded? branch if not; will load first playbook if not
NOP
SUB V0, V0, V0 //START OF LOADING FIRST PLAYBOOK FOR PLAYER 1
LUI v0, $800B
ADDIU V0, V0, $E370 //location of 1st playbook
SUB V1,V1,V1
lui V1, $800B
addiu v1,v1, $F6F0 //end of first playbook
addiu t2,T2, $0001 //increase t2 (playbook #) + 1
J YY5
nop
// part 2.2 - load player 1 custom playbook 2
719fc addiu T3,T3, $0001 //increase T3 (playbook #) + 1
YY1 BNE T2, T3 $YY2 //has playbook 2 already loaded? branch if not; will load first playbook if not
NOP
SUB V0, V0, V0 //START OF LOADING FIRST PLAYBOOK FOR PLAYER 1
LUI v0, 0X800B
ADDIU V0, V0, 0xF6F0 //location of 1st playbook
SUB V1,V1,V1
lui V1, $800C
addiu v1,v1, $0A70 //end of first playbook
addiu t2,t2, $0001 //increase S4 (playbook #) + 1
J YY5
nop
// part 2.3 - load player 1 custom playbook 3
addiu T3,T3, $0001 //increase T3 (playbook #) + 1
YY1 BNE T2, T3 $YY2 //has playbook 2 already loaded? branch if not; will load first playbook if not
NOP
SUB V0, V0, V0 //START OF LOADING FIRST PLAYBOOK FOR PLAYER 1
LUI v0, $800C
ADDIU V0, V0, $0A70 ` //location of 3rd playbook
SUB V1,V1,V1
lui V1, 0x800C
addiu v1,v1, $1DF0 //end of first playbook
addiu t2,t2, $0001 //increase S4 (playbook #) + 1
J YY5
nop
// part 2.4 - load player 1 custom playbook 4
addiu T3,T3, $0001 //increase T3 (playbook #) + 1
YY1 BNE T2, T3 $YY2 //has playbook 2 already loaded? branch if not; will load first playbook if not
NOP
SUB V0, V0, V0 //START OF LOADING FIRST PLAYBOOK FOR PLAYER 1
LUI v0, $800C
ADDIU V0, V0, $1DF0 //location of 4th playbook
SUB V1,V1,V1
lui V1, 0x800C
addiu v1,v1, $3170 //end of first playbook
sub t2,t2,t2 //reset t2 counter to 0
sub t3,t3,t3 //reset T3

J 71a88
nop

YY5
LW T6, 0x0000(V0) //load in data from first playbook in ROM
LW T7, 0x0004(V0)
LW S7, 0x0008(V0)
LW T8, 0x000C(V0)
SW T6, 0x0000(s8) //store data from first playbook into P1 data
SW T7, 0x0004(s8)
SW S7, 0x0008(s8)
SW T8, 0x000C(s8)
addiu V0,V0, 0x0010
BNE V0, S8, 0xXXX4 // when V0 = S8, branch back to original cheat code
ADDIU S8,S8 0x0010 //increase book size
0xXXX4

sub v1,v1,v1 //clear registers back to orginal values
sub v0,v0,v0
sub t6,t6,t6
sub t7,t7,t7
sub S7,S7,S7
sub T8,T8,T8
sub T1,T1,T1
sub T2,T2,T2
sub s4,s4,s4
sub t3,t3,t3

J $8024BBA4 //END OF LOOP; go back to "use team plays" function
sub s4,s4,s4 //set s4 back to nothing
« Last Edit: December 29, 2016, 05:20:12 PM by blitzmaster5000 »

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #78 on: January 01, 2017, 07:32:05 PM »
Got the code more efficient and working so that player 1 can import any of the 4 custom playbooks! The issue now is that apparently the variable that tracks which player is loading the data is actually not related to the player controller, but which slot they are when you start a game (i.e. if controller 3 is the only person playing and moves to the top left slot when starting a game, the variable will be as if it's player 1, not 3). This is an issue because it needs to know the correct controller because the area where it fills in the data always pulls from the same spot. So player 3, even if he's loaded in as player 1, still pulls the custom plays from the 3rd slot. It should work once I figure out how to find the correct player number though. Here's the updated code:

Code: [Select]
//part 0 - skip all this if it's a different cheat
0x71988 addiu s4,s4,$0022 //load 22 into s4
0x7198C bne s4,s3, $00071ae8 //check to see if it's the "use team plays" cheat; branch to jump out (0x71AE8) if not
0x71990 SW R0, $0014(sp) //from original code
0x71994 SUB S4,S4,S4 //clear s4
0x71998 SW S4, $0000(T0) //store 0 into UTP address to turn it off
0x7199C SUB v0,v0,v0 //clear V0
// part 1 - check to see if custom playbooks are even in the ROM
0x719a0 LUI S4, $800B //this part looks to see if custom plays are even in the ROM. Branch to custom code if not; 800BE000 IS ACTUALLY 800AE000
ADDIU s4, s4, $E330 //load address to monitor which playbook is loaded here /// 0xfddf90 IN ROM
LW T2, 0X0000(s4) //load value at 800BE300 into T2
BGTZ T2, $00071AE8 //Is there a custom play loaded? If so, T2 should be > 0 and it won't branch. If == 0, it will branch
nop
////////////////////////////
0x719B8 SUB V0, V0, V0
SUB V1, V1, V1
SUB T1, T1, T1
SUB T2,T2,T2
SUB T6,T6,T6
SUB T7,T7,T7
SUB T8,T8,T8
SUB S4,S4,S4
//load in correct player
0x719D8 ADDIU T1, T1, $1380 //playbook size increaser
MULT T2, A3, T1 //use this as the offset to bring in the correct plabook
MFLO T2
LUI v0, $802B
ADDIU V0, v0, $DF20 //location of playbook1
addiu v0, T2,v0 //set correct offset for which player
//load in correct playbook
ADDIU T6,T6, $4 //load up x4 multipler into T6
MULT T6,T6,A3 //multiply player # * 4 to pull up correct address to monitor (should be 800AE334, 800AE338, 800AE33C, 800AE340)
MFLO T6

0x71A04 LUI S4, $800B
ADDIU S4, S4, $E334 //finds the correct address to monitor which players playbooks are needed
ADD S4,T6,S4
LW T7, $0000(S4)
MULT T7,T1
MFLO T7
0x71A1C LUI S8, $800B
ADDIU S8,T7,$E370 //goto the correct playbook to load for any player
ADD S8,T7,S8
DIV T7,T7,T1
MFLO T7
ADDIU T7,T7, $1 //increase S4 + 1
0x71A34 SW T7,$0000(S4)
ADDIU T8,T8, $5
BEQ T8,T7, $80071A58
NOP
J $00070E70
NOP
0x71A58 SUB T7,T7,T7
SW T7, $0000(S4)
J $00070E70

0x71A70 sub t6,t6,t6
sub t7,t7,t7
sub S7,S7,S7
sub T8,T8,T8
ADD V1,S8,T1
0x71A88 LW T6, 0x0000(S8) //load in data from first playbook in ROM
LW T7, 0x0004(S8)
LW S7, 0x0008(S8)
LW T8, 0x000C(S8)
SW T6, 0x0000(V0) //store data from first playbook into P1 data
SW T7, 0x0004(V0)
SW S7, 0x0008(V0)
SW T8, 0x000C(V0)
addiu S8,S8, 0x0010
BNE S8, V1, 0x00071A88 // when V0 = S8, branch back to original cheat code
ADDIU V0,V0 0x0010 //increase book size
SUB S8,S8,S8
sub v1,v1,v1 //clear registers back to orginal values
sub v0,v0,v0
sub t6,t6,t6
sub t7,t7,t7
sub S7,S7,S7
sub T8,T8,T8
sub T1,T1,T1
sub T2,T2,T2
sub s4,s4,s4
sub t3,t3,t3
J $8024BBA4 //END OF LOOP; go back to "use team plays" function
sub s4,s4,s4 //set s4 back to nothing

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #79 on: January 04, 2017, 08:54:27 AM »
awesome work! hope to check out the rom this weekend and get reading/writing to the rom worked on.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #80 on: January 04, 2017, 09:20:33 AM »
I slightly changed the ROM since I last sent you (just moved the custom plays down a bit so I had some free addresses to store variables). I will send an updated one soon.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #81 on: January 10, 2017, 09:35:29 AM »
I almost have this working... The issue I have right now is I need to save the register values prior to modifying them for the hack to the stack and then recall them after our hack is finished. I haven't had to use the stack at all yet, so I'm still trying to figure out exactly how it works. From what I gather I need to just make room on the stack, push the reg values onto it, do our new code, and then pop the reg values off the stack. However if for whatever reason this won't work (because maybe the stack has some values it's already using that get written over or something), I will have to store them all in addresses and then load them back which is more time consuming. I'll try and have it ready in the next few days.

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #82 on: January 10, 2017, 09:11:13 PM »
Honestly that sounds beyond me, thanks for putting so much time towards this project! Not sure we would have that much new content with out you haha. I'm starting to get some time for coding projects now that the holidays have past and the NFL season is about done.  You able to send the updated ROM? if not I can continue with the one you sent.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #83 on: January 11, 2017, 11:16:06 PM »
No problem. I'm really eager to see if we can get the external playbook editor working with this hack soon! It should be awesome!

I have almost gotten the hack completely worked out - just a few additions I want to add. I ended up not trying to use the stack to save the register values that I needed to - I just saved them in some empty RAM I found and it worked great.

The last thing I want to try and work out is displaying the name of the playbook instead of the default "use team plays" when you enter the cheat. This maybe tough because it will require using the function that prints text and I'm not sure how it does it. Regardless, we should have a release ready soon that will work with the external playbook editor.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #84 on: January 19, 2017, 08:48:30 AM »
I figured out that the way the game calls the various cheat names to display when they are entered are simply in a table. I think I will be able to modify the code slightly to use the addresses of the names of the various playbooks. The hack should be just about ready by that point!

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #85 on: January 22, 2017, 01:07:37 AM »
Alright I think the hack is good to go. Just need the external editor to edit the plays now. Here is the code with a few notes on how it works. I may add more notes later to remind me how it all works...

Code: [Select]
8024BB9C: J 0x80070D88 //jump out of function that loads cheats to inject our new code
8024BBA0: SW S3, $0x0010 (SP)
//func_loaddata
80070D88: NOP
80070D8C: ADDIU S7, S7, 0x0022 //set s7 to 22
80070D90: BNE S7, S3, 0x800713AC//is s7 != s3? If so, its another cheat; jump out
80070D94: SW R0, 0x0014 (SP)
80070D98: NOP
80070D9C: J 0x80071298 //jump to other part of function that saves registers
80070DA0: SW R0, 0x0000 (T0)   //make sure use team plays cheat always resets to 0 so you can activate it again
//func_regs
80071298: SUB S3, S3, S3
8007129C: ADDIU S3, S3, 0x002C
800712A0: MULT S4, S3
800712A4: MFLO S3
800712A8: LUI S7, 0x8025
800712AC: ADDIU S7, S7, 0x0DEC
800712B0: ADD S7, S3, S7
800712B4: NOP
800712B8: SUB S3, S3, S3
800712BC: ADDIU S3, S3, 0x0022
800712C0: NOP
800712C4: NOP
800712C8: NOP
800712CC: NOP
800712D0: SW S4, 0x0000 (S7)
800712D4: SW K0, 0x0028 (S7)
800712D8: ADD K0, S4, R0
800712DC: SW S8, 0x0004 (S7)
800712E0: SW V0, 0x0008 (S7)
800712E4: SW V1, 0x000C (S7)
800712E8: SW T1, 0x0010 (S7)
800712EC: SW T2, 0x0014 (S7)
800712F0: SW T3, 0x0018 (S7)
800712F4: SW T6, 0x001C (S7)
800712F8: SW T7, 0x0020 (S7)
800712FC: SW T8, 0x0024 (S7)
80071300: SUB S7, S7, S7
80071304: SUB S8, S8, S8
80071308: SUB V0, V0, V0
8007130C: SUB V1, V1, V1
80071310: SUB T1, T1, T1
80071314: SUB T2, T2, T2
80071318: SUB T3, T3, T3
8007131C: SUB T6, T6, T6
80071320: SUB T7, T7, T7
80071324: SUB T8, T8, T8
80071328: ADDIU T6, T6, 0x0004
8007132C: MULT T6, A3
80071330: MFLO A3
80071334: LUI S4, 0x8029
80071338: ADDIU S4, S4, 0x42A0
8007133C: ADD S4, A3, S4
80071340: LW A3, 0x0000 (S4)
80071344: LUI S7, 0x800B
80071348: ADDIU S7, S7, 0xE330
8007134C: J 0x80070DA4 //jump back to previous // break
80071350: NOP
//func_loaddata
80070DA4: LUI S4, 0x800B
80070DA8: ADDIU S4, S4, 0xE330
80070DAC: LW T2, 0x0000 (S4)
80070DB0: BEQ T2, R0, 0x80071358
80070DB4: NOP
80070DB8: SUB V0, V0, V0
80070DBC: SUB V1, V1, V1
80070DC0: SUB T1, T1, T1
80070DC4: SUB T2, T2, T2
80070DC8: SUB T6, T6, T6
80070DCC: SUB T7, T7, T7
80070DD0: SUB T8, T8, T8
80070DD4: SUB S4, S4, S4
80070DD8: ADDIU T1, T1, 0x1378
80070DDC: MULT A3, T1
80070DE0: MFLO T2
80070DE4: ADDIU T8, T8, 0x1380
80070DE8: LUI V0, 0x802B
80070DEC: ADDIU V0, V0, 0xDF20
80070DF0: ADD V0, T2, V0
80070DF4: NOP
80070DF8: ADDIU T6, T6, 0x0004
80070DFC: MULT T6, A3
80070E00: MFLO T6
80070E04: LUI S4, 0x800B
80070E08: ADDIU S4, S4, 0xE334
80070E0C: ADD S4, T6, S4
80070E10: LW T7, 0x0000 (S4)
80070E14: MULT T7, T8
80070E18: MFLO T7
80070E1C: LUI S8, 0x800B
80070E20: ADDIU S8, S8, 0xE370
80070E24: ADD S8, T7, S8
80070E28: DIV T7, T8
80070E2C: MFLO T7
80070E30: ADDIU T7, T7, 0x0001
80070E34: NOP
80070E38: SUB T8, T8, T8
80070E3C: NOP
80070E40: NOP
80070E44: ADDIU T8, T8, 0x0004
80070E48: BEQ T8, T7, 0x80070E58
80070E4C: SUB T8, T8, T8
80070E50: J 0x80070E70
80070E54: SUB T6, T6, T6
80070E58: SUB T7, T7, T7
80070E5C: NOP
80070E60: J 0x80070E70
80070E64: SUB T8, T8, T8
80070E68: J 0x800E5B68
80070E6C: NOP
80070E70: SUB T6, T6, T6
80070E74: SUB T7, T7, T7
80070E78: ADDIU T8, T8, 0x1350
80070E7C: SUB S7, S7, S7
80070E80: ADD V1, T8, S8
80070E84: NOP
80070E88: LW T6, 0x0000 (S8)
80070E8C: LW T7, 0x0004 (S8)
80070E90: LW S7, 0x0008 (S8)
80070E94: LW T8, 0x000C (S8)
80070E98: SW T6, 0x0000 (V0)
80070E9C: SW T7, 0x0004 (V0)
80070EA0: SW S7, 0x0008 (V0)
80070EA4: SW T8, 0x000C (V0)
80070EA8: ADDIU S8, S8, 0x0010
80070EAC: BNE S8, V1, 0x80070E88
80070EB0: ADDIU V0, V0, 0x0010
80070EB4: SUB S8, S8, S8
80070EB8: NOP
80070EBC: NOP
80070EC0: NOP
80070EC4: SUB S7, S7, S7
80070EC8: SUB T8, T8, T8
80070ECC: SUB T1, T1, T1
80070ED0: SUB T2, T2, T2
80070ED4: SUB S4, S4, S4
80070ED8: SUB T3, T3, T3
80070EDC: SUB T6, T6, T6
80070EE0: SUB V0, V0, V0
80070EE4: SUB V1, V1, V1
80070EE8: J 0x80071354 //jump to other func_regs to load back registers
80070EEC: SUB S4, S4, S4
//func_regs
80071354: SUB S3, S3, S3
80071358: ADDIU S3, S3, 0x002C
8007135C: MULT K0, S3
80071360: MFLO S3
80071364: LUI S7, 0x8025
80071368: ADDIU S7, S7, 0x0DEC
8007136C: ADD S7, S3, S7
80071370: SUB S3, S3, S3
80071374: ADDIU S3, S3, 0x0022
80071378: LW S8, 0x0004 (S7)
8007137C: LW V0, 0x0008 (S7)
80071380: LW V1, 0x000C (S7)
80071384: LW T1, 0x0010 (S7)
80071388: LW T2, 0x0014 (S7)
8007138C: LW T3, 0x0018 (S7)
80071390: LW T6, 0x001C (S7)
80071394: LW T7, 0x0020 (S7)
80071398: LW T8, 0x0024 (S7)
8007139C: LW S4, 0x0000 (S7)
800713A0: LW K0, 0x0028 (S7)
800713A4: NOP
800713A8: NOP
800713AC: J 0x8024BBA4 //return to original code for cheats
800713B0: SUB S7, S7, S7
//func_writeText
8024BCF4: J 0x800068F7C //jump out of func that writes text to make it read from playbook titles
8024BB9C: LUI A2, 0xFF00
//func_writeCustomBookText //this part fixes the text to show the book names and for the correct

players
80068F7C: ADDIU S7, S7, 0x0022
80068F80: BNE S3, S7, 0x80069080//is it the right cheat? Branch if not out of this part
80068F84: SUB S7, S7, S7
80068F88: SUB S2, S2, S2
80068F8C: ADDIU S2, S2, 0x0004
80068F90: MULT S2, S4
80068F94: MFLO S4
80068F98: LUI S7, 0x8029
80068F9C: ADDIU S7, S7, 0x42A0 //address where game tracks which player is in each slot
80068FA0: ADD S7, S7, S4
80068FA4: LW S7, 0x0000 (S7)
80068FA8: LUI A3, 0x800B
80068FAC: ADDIU A3, A3, 0xE334
80068FB0: MULT S7, S2
80068FB4: MFLO S7
80068FB8: ADD A3, S7, A3
80068FBC: LW S7, 0x0000 (A3) //loads correct address from book tracker
80068FC0: NOP
80068FC4: NOP
80068FC8: NOP
80068FCC: NOP
80068FD0: LUI A3, 0x800B
80068FD4: ADDIU A3, A3, 0xE370 //location of beginning of book 1
80068FD8: SUB S2, S2, S2
80068FDC: ADDIU S2, S2, 0x1380 //offset of entire book to skip to different books in multiples of 1380
80068FE0: MULT S7, S2
80068FE4: MFLO S2
80068FE8: ADD A3, S2, A3
80068FEC: SUB S3, S3, S3
80068FF0: ADDIU S3, S3, 0x0004
80068FF4: ADDIU S7, S7, 0x0001 //increase value of book number tracker
80068FF8: BEQ S3, S7, 0x8006905C//is the book tracker == 4? if so, branch to reset it to the first book
80068FFC: SUB S2, S2, S2
80069000: NOP
80069004: LUI S2, 0x8029
80069008: ADDIU S2, S2, 0x42A0
8006900C: ADD S2, S4, S2
80069010: LW S2, 0x0000 (S2)
80069014: MULT S2, S3
80069018: MFLO S2
8006901C: SUB S3, S3, S3
80069020: LUI S3, 0x800B
80069024: ADDIU S3, S3, 0xE334
80069028: ADD S3, S3, S2
8006902C: SW S7, 0x0000 (S3)
80069030: SUB S7, S7, S7
80069034: ADDIU S7, S7, 0x0004
80069038: DIV S4, S7
8006903C: MFLO S4
80069040: SUB S7, S7, S7
80069044: SUB S3, S3, S3
80069048: ADDIU S3, S3, 0x0022
8006904C: SUB S2, S2, S2
80069050: ADDIU S2, S2, 0x0008
80069054: J 0x8024BCFC
80069058: NOP
8006905C: SUB S7, S7, S7
80069060: NOP
80069064: NOP
80069068: NOP
8006906C: J 0x80069000
80069070: NOP
80069074: NOP
80069078: J 0x8024BCFC
8006907C: NOP
80069080: J 0x8024BCFC
80069084: LW A3, 0x2F84 (A3)
80069088: NOP
8006908C: SUB R0, R0, R0
80069090: ADDU R0, R0, R0
« Last Edit: January 22, 2017, 01:41:23 PM by blitzmaster5000 »

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #86 on: January 22, 2017, 03:27:47 PM »
Tested the hack a bit today. It seems like everything is pretty much working, although in Project64 I got a fatal error twice at random points. I'm not sure why this is (the error message had no good information about it), but I changed the setting in the ROM config from "physical lookup table" to "virtual lookup table" and I never had it appear again. Hopefully this fixes it.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #87 on: May 26, 2017, 10:53:02 AM »
Jake: with folks putting in some new graphics, I was thinking about the hack where we have the external playbooks loaded onto the ROM. I was worried that if people import new images into the ROM (such as the Texans away uniforms), that it will automatically write over that data as it comes right after the image table. Is this the case? Either way, even if it automatically shifted down the code for the external playbooks, this will mess up all the custom code for loading the books as the way I have it written right now will still pull from the same addresses, but there will of course be image table info there instead.

We could remedy the situation by having the graphics editor also modify the code I have for loading the custom books to shift accordingly. It should only be a few lines here or there. Let me know what you think.

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #88 on: May 26, 2017, 10:43:58 PM »
Jake: with folks putting in some new graphics, I was thinking about the hack where we have the external playbooks loaded onto the ROM. I was worried that if people import new images into the ROM (such as the Texans away uniforms), that it will automatically write over that data as it comes right after the image table. Is this the case? Either way, even if it automatically shifted down the code for the external playbooks, this will mess up all the custom code for loading the books as the way I have it written right now will still pull from the same addresses, but there will of course be image table info there instead.

We could remedy the situation by having the graphics editor also modify the code I have for loading the custom books to shift accordingly. It should only be a few lines here or there. Let me know what you think.

Yeah we for sure can get it to work. I could probably add code to the play editor also to read and edit the hack to move the plays down farther.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #89 on: May 30, 2017, 07:21:45 PM »
I think I figured out some more details about how the game pulls in the custom plays. I noticed the play data in RAM for the first custom play is actually the exact same as before I imported some new graphics. I think this will make things much easier - i.e. I don't think the absolute address matters for the custom plays as long as they don't move relative to where they are in the file table. On the other hand, it seems that the 2,3,4 playbooks aren't looking correctly. I'm wondering if something got moved slightly when I used the editor as I had left some space between plays. I think that this could possibly shift all of the addresses if so. I'll look into it and let you know. I think that we may actually get away with not even having to edit the code based on what I've seen so far.