(SNES) Tracing controller input for a cutscene skip

Started by Autumn Shinespark, November 08, 2020, 09:09:31 AM

Previous topic - Next topic

Autumn Shinespark

There's a scene in Arcana where you can press A to cancel the animation early, when traveling between towns. I wanted to find the code that listens for the A press, but I'm not sure where to break in RAM. Super Famicom wiki lists $4218-4219 for controller 1 port data, and $4016-4017 for old style joypad registers. But, reading and writing don't "register"; I just get a MVN much later.

I was hoping to repurpose the A listen to skip the intro cutscene, but I could use some help before getting to that step.
If you need me, I'll be over-analyzing how games work... instead of playing them.

Raeven0

These aren't RAM; they're hardware registers mapped to memory addresses. Make sure you're reading at something equivalent to $004218, not at $7e4218.

Your choice of emulator may matter. bsnes-plus exposes hardware registers in the logical way, but I don't know whether geiger's or mesen-s do.

FAST6191

You can listen for buttons, I often do in various things. However here I would probably look instead for a function that is only fired when you skip (should be fairly easy if you have a log of things fired, might even have one of those nice "these are the new functions called" thing like FCEUX has in a debugger emulator but I am less familiar with SNES stuff these days) and then work backwards.

Autumn Shinespark

#3
Yeah I would just trace both ways and compare the difference, but the trace log makes no sense.
$00/8335 C2 30       REP #$30                A:0000 X:0090 Y:0009 D:1E00 DB:80 S:1FF5 P:envMxdIZC HC:0086 VC:225 FC:08 I:00
$80/88ED AD 20 00    LDA $0020  [$80:0020]   A:0000 X:0098 Y:0009 D:1E00 DB:80 S:1FF9 P:envMxdIZC HC:0016 VC:225 FC:09 I:00
$00/8335 C2 30       REP #$30                A:0000 X:0098 Y:0009 D:1E00 DB:80 S:1FF5 P:envMxdIZC HC:0110 VC:225 FC:09 I:00
$00/8335 C2 30       REP #$30                A:0000 X:00A0 Y:0009 D:1E00 DB:80 S:1FF5 P:envMxdIZC HC:0088 VC:225 FC:10 I:00

It just runs that forever if I don't break on something in particular. Maybe I can find the X,Y of the sprites moving across the screen to break on. Only thing is, they stop changing after pressing A so there's nothing to break on there.
If you need me, I'll be over-analyzing how games work... instead of playing them.

FAST6191

Is that not enough?

Find whatever function is twiddling the location data and see what it says -- there will be some kind of IF ELSE arrangement somewhere in the preceding instructions (or thing that called the movement function).

KingMike

I know NES games will, but I think SNES game will as well, when they read the button inputs, mirror them to RAM.
Look for the code the reads the addresses (again, making sure it is not confused with an actual memory address like 7E/7F:4218) and see if the results are being copied to somewhere in RAM.

It is very likely the data will be sent to RAM, so it can be further processed, such as filtering into "held" and "pressed" button state. (for the later, most humans probably cannot physically press and release a button at a 60hz rate, so input filtering, that is removing button inputs that are the same between consecutive frames, would need to be done so that a button registered as pressed will count as a single press, until the button is released, rather than count as 10, 20, etc. presses)

So you probably want to find that RAM mirror of the button data and check for that instead.

One example of this state I can think of is on the NES: pausing in Winter Games. It would seem like when Start is pressed to pause the game, the game is just ignoring Start inputs for some number of frames which it assumes is long enough for a person to lift their finger, and if it still is pressed after that, it assumes another press.
(that is, try pressing and holding the Start button to pause the game and keep holding for like a second or two, and notice it unpauses once the button is lifted.)
Then try a good game like Super Mario Bros., again press Start to pause and keep the button held for an exaggerated length. Lift the button and notice the game is still paused.
"My watch says 30 chickens" Google, 2018

Autumn Shinespark

Hmm, the only references to $004218 are within an interrupt; it's constantly loaded so I had to trace a log for another variable $070B that increases/decreases with certain map movements. This is the end of a loop in one interrupt; looks like it's stored to $000000 along with everything else near 4218. Uh...??

$00/839F A2 06 00    LDX #$0006              A:0000 X:00F8 Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:1022 VC:234 FC:15 I:00
.......(loops skipped)
$00/83A2 BD 18 42    LDA $4218,x[$00:4218]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0614 VC:236 FC:15 I:00
$00/83A5 29 F0 FF    AND #$FFF0              A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0664 VC:236 FC:15 I:00
$00/83A8 85 00       STA $00    [$00:0000]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0696 VC:236 FC:15 I:00
$00/83AA B5 21       LDA $21,x  [$00:0021]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0736 VC:236 FC:15 I:00
$00/83AC 49 FF FF    EOR #$FFFF              A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0782 VC:236 FC:15 I:00
$00/83AF 25 00       AND $00    [$00:0000]   A:FFFF X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzC HC:0814 VC:236 FC:15 I:00
$00/83B1 95 31       STA $31,x  [$00:0031]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0854 VC:236 FC:15 I:00
$00/83B3 A5 00       LDA $00    [$00:0000]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0900 VC:236 FC:15 I:00
$00/83B5 D5 21       CMP $21,x  [$00:0021]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0940 VC:236 FC:15 I:00
$00/83B7 95 21       STA $21,x  [$00:0021]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0986 VC:236 FC:15 I:00
$00/83B9 F0 0B       BEQ $0B    [$83C6]      A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:1032 VC:236 FC:15 I:00
$00/83C6 B4 39       LDY $39,x  [$00:0039]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZC HC:1062 VC:236 FC:15 I:00
$00/83C8 F0 06       BEQ $06    [$83D0]      A:0000 X:0000 Y:0001 D:0000 DB:00 S:1FEA P:envmxdIzC HC:1108 VC:236 FC:15 I:00
$00/83CA D6 39       DEC $39,x  [$00:0039]   A:0000 X:0000 Y:0001 D:0000 DB:00 S:1FEA P:envmxdIzC HC:1132 VC:236 FC:15 I:00
$00/83CC 74 29       STZ $29,x  [$00:0029]   A:0000 X:0000 Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:1200 VC:236 FC:15 I:00
$00/83CE 80 07       BRA $07    [$83D7]      A:0000 X:0000 Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:1246 VC:236 FC:15 I:00
$00/83D7 CA          DEX                     A:0000 X:0000 Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:1276 VC:236 FC:15 I:00
$00/83D8 CA          DEX                     A:0000 X:FFFF Y:0001 D:0000 DB:00 S:1FEA P:eNvmxdIzC HC:1298 VC:236 FC:15 I:00
$00/83D9 10 C7       BPL $C7    [$83A2]      A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:eNvmxdIzC HC:1320 VC:236 FC:15 I:00
$00/83DB AD 21 00    LDA $0021  [$00:0021]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:eNvmxdIzC HC:1344 VC:236 FC:15 I:00
$00/83DE 8D 25 00    STA $0025  [$00:0025]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0028 VC:237 FC:15 I:00
$00/83E1 AD 23 00    LDA $0023  [$00:0023]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0076 VC:237 FC:15 I:00
$00/83E4 8D 27 00    STA $0027  [$00:0027]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0124 VC:237 FC:15 I:00
$00/83E7 AD 31 00    LDA $0031  [$00:0031]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0172 VC:237 FC:15 I:00
$00/83EA 8D 35 00    STA $0035  [$00:0035]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0220 VC:237 FC:15 I:00
$00/83ED AD 33 00    LDA $0033  [$00:0033]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0268 VC:237 FC:15 I:00
$00/83F0 8D 37 00    STA $0037  [$00:0037]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0316 VC:237 FC:15 I:00
$00/83F3 AD 29 00    LDA $0029  [$00:0029]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0364 VC:237 FC:15 I:00
$00/83F6 8D 2D 00    STA $002D  [$00:002D]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0412 VC:237 FC:15 I:00
$00/83F9 AD 2B 00    LDA $002B  [$00:002B]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0460 VC:237 FC:15 I:00
$00/83FC 8D 2F 00    STA $002F  [$00:002F]   A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0508 VC:237 FC:15 I:00
$00/83FF 60          RTS                     A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEA P:envmxdIZC HC:0596 VC:237 FC:15 I:00


$00/8373 AB          PLB                     A:0000 X:FFFE Y:0001 D:0000 DB:00 S:1FEC P:envmxdIZC HC:0646 VC:237 FC:15 I:00
$00/8374 2B          PLD                     A:0000 X:FFFE Y:0001 D:0000 DB:80 S:1FED P:eNvmxdIzC HC:0682 VC:237 FC:15 I:00
$00/8375 7A          PLY                     A:0000 X:FFFE Y:0001 D:1E00 DB:80 S:1FEF P:envmxdIzC HC:0726 VC:237 FC:15 I:00
$00/8376 FA          PLX                     A:0000 X:FFFE Y:0009 D:1E00 DB:80 S:1FF1 P:envmxdIzC HC:0770 VC:237 FC:15 I:00
$00/8377 68          PLA                     A:0000 X:00F8 Y:0009 D:1E00 DB:80 S:1FF3 P:envmxdIzC HC:0814 VC:237 FC:15 I:00
$00/8378 40          RTI                     A:0000 X:00F8 Y:0009 D:1E00 DB:80 S:1FF5 P:envmxdIZC HC:0858 VC:237 FC:15 I:00
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

#7
7e:0021 and 7e:0022 are the button presses in ram. The easiest way to find button presses for me is to just look at the ram when you
press buttons and see what values are changing or not.

This looks like a button press value loading from ram.
$00/83AA B5 21       LDA $21,x  [$00:0021]

7e:0025 and 7e:0026 also look like button presses because they seem to be storing the same values
when you press buttons.

Here is also some code grabing button press from register and storing to ram:


$00/83A2 BD 18 42    LDA $4218,x[$00:4218]   A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZCHC:0566 VC:236 00 FL:16
$00/83A5 29 F0 FF    AND #$FFF0              A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0602 VC:236 00 FL:16
$00/83A8 85 00       STA $00    [$00:0000]   A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0626 VC:236 00 FL:16
$00/83AA B5 21       LDA $21,x  [$00:0021]   A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0658 VC:236 00 FL:16
$00/83AC 49 FF FF    EOR #$FFFF              A:0000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:envmxdIZCHC:0696 VC:236 00 FL:16
$00/83AF 25 00       AND $00    [$00:0000]   A:FFFF X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0720 VC:236 00 FL:16
$00/83B1 95 31       STA $31,x  [$00:0031]   A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0752 VC:236 00 FL:16
$00/83B3 A5 00       LDA $00    [$00:0000]   A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0790 VC:236 00 FL:16
$00/83B5 D5 21       CMP $21,x  [$00:0021]   A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0822 VC:236 00 FL:16
$00/83B7 95 21       STA $21,x  [$00:0021]   A:8000 X:0000 Y:0003 D:0000 DB:00 S:1FEA P:eNvmxdIzCHC:0860 VC:236 00 FL:16


I believe this is a B-button press.

Also $00:0000 and $00:0001 are the button presses. Looks like its going to be fun digging through these. :laugh:

Autumn Shinespark

#8
Ugggghhhhhh! Alright, so... ChibiAkuma's blog shows the bits as:

r $4218 JOY1L Joypad #1 status (set during interrupt) AXLR----
r $4219 JOY1H Joypad #1 status (if $4200 is set) BYSTUDLR

So when it does AND #$FFF0, it's checking just those top 12 bits. 8000 should be... oh, a B press. (I don't remember pressing B.) Then it loads a button press from RAM, !B & A and stores in 0031. Okay but why tho.  :huh:

Hang on, it loops 6 times but there's 12 bits. So each loop probably checks 2 buttons at once.


Looks like I found where it checks the A button specifically, followed by 902B loading 0C (the event handler's Jump If True). Good thing I have detailed notes on which sub-language events do what, never would've found it looking for a regular jump!
$80/9B02 A7 10       LDA [$10]  [$98:D5E0]   A:0000 X:0000 Y:0002 D:1E00 DB:80 S:1FF1 P:eNvmxdIzc HC:1102 VC:249 FC:25 I:00
$80/9B04 E6 10       INC $10    [$00:1E10]   A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF1 P:envmxdIzc HC:1156 VC:249 FC:25 I:00
$80/9B06 60          RTS                     A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF1 P:eNvmxdIzc HC:1212 VC:249 FC:25 I:00


$80/A02D 85 20       STA $20    [$00:1E20]   A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:eNvmxdIzc HC:1258 VC:249 FC:25 I:00
$80/A02F BD 21 00    LDA $0021,x[$80:0021]   A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:eNvmxdIzc HC:1298 VC:249 FC:25 I:00
$80/A032 25 20       AND $20    [$00:1E20]   A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1344 VC:249 FC:25 I:00
$80/A034 6B          RTL                     A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:0014 VC:250 FC:25 I:00


$80/9544 AE 41 10    LDX $1041  [$80:1041]   A:0080 X:0000 Y:0002 D:1E00 DB:80 S:1FF6 P:envmxdIzc HC:0062 VC:250 FC:25 I:00
$80/9547 9D B3 0C    STA $0CB3,x[$80:0CBF]   A:0080 X:000C Y:0002 D:1E00 DB:80 S:1FF6 P:envmxdIzc HC:0102 VC:250 FC:25 I:00
$80/954A E6 10       INC $10    [$00:1E10]   A:0080 X:000C Y:0002 D:1E00 DB:80 S:1FF6 P:envmxdIzc HC:0148 VC:250 FC:25 I:00
$80/954C 60          RTS                     A:0080 X:000C Y:0002 D:1E00 DB:80 S:1FF6 P:eNvmxdIzc HC:0204 VC:250 FC:25 I:00


$80/903A 80 15       BRA $15    [$9051]      A:0080 X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:eNvmxdIzc HC:0250 VC:250 FC:25 I:00
$80/9051 AE 41 10    LDX $1041  [$80:1041]   A:0080 X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:eNvmxdIzc HC:0274 VC:250 FC:25 I:00
$80/9054 BD 9F 0B    LDA $0B9F,x[$80:0BAB]   A:0080 X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:envmxdIzc HC:0314 VC:250 FC:25 I:00
$80/9057 F0 D2       BEQ $D2    [$902B]      A:0000 X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:envmxdIZc HC:0360 VC:250 FC:25 I:00
$80/902B A7 10       LDA [$10]  [$98:D5E2]   A:0000 X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:envmxdIZc HC:0408 VC:250 FC:25 I:00
$80/902D 29 FF 00    AND #$00FF              A:ED0C X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:eNvmxdIzc HC:0462 VC:250 FC:25 I:00
$80/9030 C9 30 00    CMP #$0030              A:000C X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:envmxdIzc HC:0486 VC:250 FC:25 I:00
$80/9033 B0 07       BCS $07    [$903C]      A:000C X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:eNvmxdIzc HC:0510 VC:250 FC:25 I:00
$80/9035 0A          ASL A                   A:000C X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:eNvmxdIzc HC:0528 VC:250 FC:25 I:00
$80/9036 AA          TAX                     A:0018 X:000C Y:0002 D:1E00 DB:80 S:1FF8 P:envmxdIzc HC:0586 VC:250 FC:25 I:00
$80/9037 FC 67 90    JSR ($9067,x)[$80:9562] A:0018 X:0018 Y:0002 D:1E00 DB:80 S:1FF8 P:envmxdIzc HC:0604 VC:250 FC:25 I:00

So if I change the comparison value LDA [$10]  [$98:D5E0] from 0080 to 8000... aha! The traveling cutscene skip switches from the A button to the B button  :beer: That was very difficult to trace, basically had the game breaking on button read every frame, so I had to mash A after clicking Run to register the input. Also confirmed this code is just for the travelling cutscene; the intro crawl has a different skip.

That leaves how to make it do this during the intro cutscene... at least I now have sub-language code to manually trace backwards with, may be able to insert it if I can find a location and also which sub-language code the intro cutscene is running. Thanks for the help!
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

What I would probably try to do is find the screen close();
function so when you press the button that you want to skip the intro it will start the close screen event. This is probably going to use the Screen Display register $2100. The bits 3-0 in the $2100 register will probably count down from 0xf to 0x0 to close the screen.

The other thing you would want to try and find is the screen open(); function so you can open the screen that starts the game. This function will probably use the BGMODE register $2105 to set the bg mode. If the screen open function doesn't set the bg mode(which I would think it would) I would try to find when the gfx for the background gets Dma'd to vram and trace back from there to see if you can find the start of the screen load function.

If I have time later tonight I might try to take a look at it if you don't find those functions by then. Although I have never played the game before I think this is a good idea and it is something that's definitely possible to do. It will probably take some time to figure it out but it would be worth it.

Autumn Shinespark

#10
I'll give that a shot later today!
Also to skip the intro, you can use level select. (Yes, an RPG with a level select). On the title screen press:
Select Down Select Select, X Y Select Select, L R Select Select, Left Right Up A for Chapter 2.

Nope, I'm not finding them. Looks like AFTER the screen open/close it calls dma 6, 1, 0 though.
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

part of closing screen

$00/903A 80 15       BRA $15    [$9051]      A:866B X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:eNvmxdIzcHC:0846 VC:237 00 FL:01
$00/9051 AE 41 10    LDX $1041  [$00:1041]   A:866B X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:eNvmxdIzcHC:0868 VC:237 00 FL:01
$00/9054 BD 9F 0B    LDA $0B9F,x[$00:0B9F]   A:866B X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:envmxdIZcHC:0908 VC:237 00 FL:01
$00/9057 F0 D2       BEQ $D2    [$902B]      A:0000 X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:envmxdIZcHC:0948 VC:237 00 FL:01
$00/902B A7 10       LDA [$10]  [$17:866B]   //sets function for function loader
$00/902D 29 FF 00    AND #$00FF              A:DB07 X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:eNvmxdIzcHC:1050 VC:237 00 FL:01
$00/9030 C9 30 00    CMP #$0030              A:0007 X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:envmxdIzcHC:1074 VC:237 00 FL:01
$00/9033 B0 07       BCS $07    [$903C]      A:0007 X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:eNvmxdIzcHC:1098 VC:237 00 FL:01
$00/9035 0A          ASL A                   A:0007 X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:eNvmxdIzcHC:1114 VC:237 00 FL:01
$00/9036 AA          TAX                     A:000E X:0000 Y:0000 D:1E00 DB:00 S:1FF5 P:envmxdIzcHC:1128 VC:237 00 FL:01
$00/9037 FC 67 90    JSR ($9067,x)[$00:9527] //function loader for open close plus others

$00/9527 E6 10       INC $10    [$00:1E10]   A:000E X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:1204 VC:237 00 FL:02
$00/9529 A7 10       LDA [$10]  [$17:866C]   //pointer for JML $A0DB
$00/952B 8D 49 10    STA $1049  [$00:1049]   A:A0DB X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:eNvmxdIzcHC:1338 VC:237 00 FL:02
$00/952E E6 10       INC $10    [$00:1E10]   A:A0DB X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:eNvmxdIzcHC:0010 VC:238 00 FL:02
$00/9530 E6 10       INC $10    [$00:1E10]   A:A0DB X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:eNvmxdIzcHC:0064 VC:238 00 FL:02
$00/9532 A7 10       LDA [$10]  [$17:866E]   A:A0DB X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:eNvmxdIzcHC:0142 VC:238 00 FL:02
$00/9534 29 FF 00    AND #$00FF              A:0600 X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0198 VC:238 00 FL:02
$00/9537 8D 4B 10    STA $104B  [$00:104B]   A:0000 X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIZcHC:0222 VC:238 00 FL:02
$00/953A AE 41 10    LDX $1041  [$00:1041]   A:0000 X:000E Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIZcHC:0262 VC:238 00 FL:02
$00/953D BD B3 0C    LDA $0CB3,x[$00:0CB3]   A:0000 X:0000 Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIZcHC:0302 VC:238 00 FL:02
$00/9540 22 0E 9B 00 JSL $009B0E[$00:9B0E]   A:000E X:0000 Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0342 VC:238 00 FL:02

$00/9B0E DC 49 10    JML [$1049][$00:A0DB]   //JML $A0DB
$00/A0DB AD 42 00    LDA $0042  [$00:0042]   //start of close screen function
$00/A0DE 29 FF 00    AND #$00FF              A:030E X:0000 Y:0000 D:1E00 DB:00 S:1FF0 P:envmxdIzcHC:0498 VC:238 00 FL:03
$00/A0E1 F0 04       BEQ $04    [$A0E7]      A:000E X:0000 Y:0000 D:1E00 DB:00 S:1FF0 P:envmxdIzcHC:0522 VC:238 00 FL:03
$00/A0E3 3A          DEC A                   A:000E X:0000 Y:0000 D:1E00 DB:00 S:1FF0 P:envmxdIzcHC:0538 VC:238 00 FL:03
$00/A0E4 20 27 83    JSR $8327  [$00:8327]   A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FF0 P:envmxdIzcHC:0552 VC:238 00 FL:03

$00/8327 E2 20       SEP #$20                A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FEE P:envmxdIzcHC:0598 VC:238 00 FL:04
$00/8329 8D 42 00    STA $0042  [$00:0042]   A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FEE P:envMxdIzcHC:0620 VC:238 00 FL:04
$00/832C 8D 41 00    STA $0041  [$00:0041]   A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FEE P:envMxdIzcHC:0652 VC:238 00 FL:04
$00/832F 8D 00 21    STA $2100  [$00:2100]   //screen display register
$00/8332 C2 20       REP #$20                A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FEE P:envMxdIzcHC:0714 VC:238 00 FL:04
$00/8334 60          RTS                     A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FEE P:envmxdIzcHC:0736 VC:238 00 FL:04

$00/A0E7 6B          RTL                     A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FF0 P:envmxdIzcHC:0778 VC:238 00 FL:03

$00/9544 AE 41 10    LDX $1041  [$00:1041]   A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0822 VC:238 00 FL:02
$00/9547 9D B3 0C    STA $0CB3,x[$00:0CB3]   A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIZcHC:0862 VC:238 00 FL:02
$00/954A E6 10       INC $10    [$00:1E10]   A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FF3 P:envmxdIZcHC:0902 VC:238 00 FL:02
$00/954C 60          RTS                     A:000D X:0000 Y:0000 D:1E00 DB:00 S:1FF3 P:eNvmxdIzcHC:0956 VC:238 00 FL:02


part of open screen

open

$00/903A 80 15       BRA $15    [$9051]      A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:eNvmxdIzcHC:0484 VC:076 00 FL:03
$00/9051 AE 41 10    LDX $1041  [$00:1041]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:eNvmxdIzcHC:0506 VC:076 00 FL:03
$00/9054 BD 9F 0B    LDA $0B9F,x[$00:0B9F]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:envmxdIZcHC:0546 VC:076 00 FL:03
$00/9057 F0 D2       BEQ $D2    [$902B]      A:0000 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:envmxdIZcHC:0586 VC:076 00 FL:03
$00/902B A7 10       LDA [$10]  [$17:8F8D]   A:0000 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:envmxdIZcHC:0632 VC:076 00 FL:03
$00/902D 29 FF 00    AND #$00FF              A:6907 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:envmxdIzcHC:0688 VC:076 00 FL:03
$00/9030 C9 30 00    CMP #$0030              A:0007 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:envmxdIzcHC:0712 VC:076 00 FL:03
$00/9033 B0 07       BCS $07    [$903C]      A:0007 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:eNvmxdIzcHC:0736 VC:076 00 FL:03
$00/9035 0A          ASL A                   A:0007 X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:eNvmxdIzcHC:0752 VC:076 00 FL:03
$00/9036 AA          TAX                     A:000E X:0000 Y:0005 D:1E00 DB:00 S:1FF8 P:envmxdIzcHC:0766 VC:076 00 FL:03
$00/9037 FC 67 90    JSR ($9067,x)[$00:9527] //function loader for open close plus others

$00/9527 E6 10       INC $10    [$00:1E10]   A:000E X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIzcHC:0842 VC:076 00 FL:04
$00/9529 A7 10       LDA [$10]  [$17:8F8E]   A:000E X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:eNvmxdIzcHC:0920 VC:076 00 FL:04
$00/952B 8D 49 10    STA $1049  [$00:1049]   A:9D69 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:eNvmxdIzcHC:0976 VC:076 00 FL:04
$00/952E E6 10       INC $10    [$00:1E10]   A:9D69 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:eNvmxdIzcHC:1016 VC:076 00 FL:04
$00/9530 E6 10       INC $10    [$00:1E10]   A:9D69 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:eNvmxdIzcHC:1070 VC:076 00 FL:04
$00/9532 A7 10       LDA [$10]  [$17:8F90]   A:9D69 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:eNvmxdIzcHC:1148 VC:076 00 FL:04
$00/9534 29 FF 00    AND #$00FF              A:0100 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIzcHC:1204 VC:076 00 FL:04
$00/9537 8D 4B 10    STA $104B  [$00:104B]   A:0000 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIZcHC:1228 VC:076 00 FL:04
$00/953A AE 41 10    LDX $1041  [$00:1041]   A:0000 X:000E Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIZcHC:1268 VC:076 00 FL:04
$00/953D BD B3 0C    LDA $0CB3,x[$00:0CB3]   A:0000 X:0000 Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIZcHC:1308 VC:076 00 FL:04
$00/9540 22 0E 9B 00 JSL $009B0E[$00:9B0E]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIzcHC:1348 VC:076 00 FL:04

$00/9B0E DC 49 10    JML [$1049][$00:9D69]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0036 VC:077 00 FL:05
$00/9D69 20 F0 9A    JSR $9AF0  [$00:9AF0]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0096 VC:077 00 FL:05

$00/9AF0 E6 10       INC $10    [$00:1E10]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envmxdIzcHC:0142 VC:077 00 FL:06
$00/9AF2 A7 10       LDA [$10]  [$17:8F91]   A:0080 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:eNvmxdIzcHC:0220 VC:077 00 FL:06
$00/9AF4 29 FF 00    AND #$00FF              A:0701 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envmxdIzcHC:0276 VC:077 00 FL:06
$00/9AF7 60          RTS                     A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envmxdIzcHC:0300 VC:077 00 FL:06

$00/9D6C 4C BB 81    JMP $81BB  [$00:81BB]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0342 VC:077 00 FL:05
$00/81BB 20 BF 81    JSR $81BF  [$00:81BF]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0366 VC:077 00 FL:05

$00/81BF E2 20       SEP #$20                A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envmxdIzcHC:0412 VC:077 00 FL:06
$00/81C1 EB          XBA                     A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIzcHC:0434 VC:077 00 FL:06
$00/81C2 AD 44 00    LDA $0044  [$00:0044]   A:0100 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIZcHC:0454 VC:077 00 FL:06
$00/81C5 29 F0       AND #$F0                A:0101 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIzcHC:0486 VC:077 00 FL:06
$00/81C7 8D 44 00    STA $0044  [$00:0044]   A:0100 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIZcHC:0502 VC:077 00 FL:06
$00/81CA EB          XBA                     A:0100 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIZcHC:0534 VC:077 00 FL:06
$00/81CB 0D 44 00    ORA $0044  [$00:0044]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIzcHC:0554 VC:077 00 FL:06
$00/81CE 8D 44 00    STA $0044  [$00:0044]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIzcHC:0586 VC:077 00 FL:06
$00/81D1 8D 05 21    STA $2105  [$00:2105]   //bg mode
$00/81D4 C2 20       REP #$20                A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envMxdIzcHC:0648 VC:077 00 FL:06
$00/81D6 60          RTS                     A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF1 P:envmxdIzcHC:0670 VC:077 00 FL:06

$00/81BE 6B          RTL                     A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF3 P:envmxdIzcHC:0712 VC:077 00 FL:05

$00/9544 AE 41 10    LDX $1041  [$00:1041]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIzcHC:0756 VC:077 00 FL:04
$00/9547 9D B3 0C    STA $0CB3,x[$00:0CB3]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIZcHC:0796 VC:077 00 FL:04
$00/954A E6 10       INC $10    [$00:1E10]   A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF6 P:envmxdIZcHC:0836 VC:077 00 FL:04
$00/954C 60          RTS                     A:0001 X:0000 Y:0005 D:1E00 DB:00 S:1FF6 P:eNvmxdIzcHC:0890 VC:077 00 FL:04


close screen function loader bytes
$17:866B //close
07 DB A0 00 06

There are a bunch of these 5 byte tables. Ill look up some more later for you.

Autumn Shinespark

#12
Wow you found that fast for no experience!
The tables loaded by $00/902B have a lot of different values, you just got lucky that they were both 07 (load function). Other common values:
0B: Jump to address if zero set
0C: Jump to address if zero clear
11: Jump to address if carry set (greater than)
1B: JSR
1E: Store value given to $0CB3,x
1F: Store value at RAM address given to $0CB3,x

It's basically a sub-language, for reasons that elude me. Half the game's instructions are translated through those, which makes tracing a total pain when it calls 06 (which does something I don't know then ends up somewhere completely different).
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

#13
"Wow you found that fast for no experience!"
I'm not familiar with Arcana's asm code but I do have snes coding experience. :happy:

I made it to where you can skip the intro when starting a new game.
Here is what I did:


change this
$17/83FB A9 1B 83    LDA #$831B
$17/83FE A0 17 00    LDY #$0017

to this
$17/83FB A9 89 8f    LDA #$8f89
$17/83FE A0 17 00    LDY #$0017

[$17:831b = start game to intro]
[$17:8F89 = start game to 1st level]


I know this isn't exactly what you want but it should help out to get a idea of what you need to do.
I could try to help you out a little more if you would like me to but I will need a save state just before
"There's a scene in Arcana where you can press A to cancel the animation early, when traveling between towns".

I can try tracing the code and see if I can mimic this code in the intro to skip it for the A-Button press.
The snes debugger that I like to use is [Snes9X v1.43.ep9r8 - Geiger's Snes9x Debugger] so if you can post a save
state for that debugger that would be great.

Also it looks like $7e:18CD is the current level.

November 14, 2020, 02:32:51 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

Here is something else that you might find interesting.

$17:8F71 89 8f //pointer to [$17:8F89 = start game to 1st level]

change this
$17:8F71 89 8f

to this
$17:8F71 1b 83

This will make the intro start a second time after the intro is finished
and when the second intro is finished it looks like you get the ending credits.

Autumn Shinespark

#14
Whoa. Thank you!
Oh, that scene is accessible right by the beginning. After the intro text just hold up and mash A to get through all the dialogue and leave town.

And this game has some wacky things saved adjacent. I was mucking up the dungeon X/Y position and warping to other dungeons and towns, something you can't do. But warping to the credits would be amazing for testing!

If you want to keep helping out, I'd really appreciate it. I have a lot of RAM addresses documented here if it will help you.


Oh, I wasn't able to reproduce your "start at first level"; I just got a black screen.
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

#15
Yea, I'll definitely still help you out with this but I might not have time for a
couple of days.

The is all I changed to start at 1st level instead of it starting the intro then the 1st level.


I do have a idea of moving the sub language code that starts at $17:831b and move it to another
location and just add in the b-button sub language code but Ill need to run some tests. I might
be able to run some tests on it tomorrow night but its probably not going to be until Wednesday
night until I can work on it.


Autumn Shinespark

That's odd, it only works in vanilla. What the heck  :laugh:
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

If you have a patch for the one you're using I can see why its not working
correctly for that one.

I haven't really been able to look at some more stuff for creating a button press event
for the intro but I did find a couple other things that will help.

Change this:
$00:A212 4D 80

To this:
$00:A212 58 80

It will skip the HAL intro. Next I'll see if I can decode the sub-code for the screen that does
load in HAL's place. It has a A-Button press to skip it and I should hopefully be able to implement
that code for the intro that you would like to add the A-Button press to, to skip it.

Autumn Shinespark

I'm using the current version of SOR. I'll try those out in vanilla and see what I can find!
...Really need to document and reverse engineer that fastrom patch, the author disappeared a few years ago and its hacks have caused as many problems as they've fixed.
If you need me, I'll be over-analyzing how games work... instead of playing them.

slidelljohn

If the fastrom patch is causing that many problems it might be a good idea to create a
new fastrom patch. You just need to get asm dissembled to make it easy to create. I wont
really have time to help with that though.

I created a patch that removes the A-Button press for the text after the HAL screen.

http://www.mediafire.com/file/fhaj2rnmyqhcx11/Arcana_%2528U%2529_removed_A-Button_press_1st_group_of_text_after_HAL_screen.ips/file

Here is the data for the sub-language before the tile screen.

$17:804D 24 00

$17:804F 11 02 55 80 8D 82 // 55 80 = return to $17:8055, 8D 82 = ???

$17:8055 1B 8E 91 // = HAL opening screen

$17:8058 07 77 81 00

$17:805C 07 69 9D 00 01

$17:8061 07 93 9D 00 00 00 60 00

$17:8069 07 6F 9D 00 02 00 00 50 00 0C

$17:8073 07 B6 9D 00 1F

$17:8078 07 A8 9D 00 14

$17:807D 07 40 A1 00 F0 8F 17 00 08 00

$17:8087 07 97 A0 00 24 81 17 00

$17:808F 07 97 A0 00 73 90 17 01

$17:8097 07 F9 9C 00 4F 8A 01

$17:809E 07 A8 A0 00 

$17:80A2 07 CC D4 18 29 81 17 00

$17:80AA 06 05

$17:80AC 07 F9 9C 00 1B 81 17

$17:80B3 16 22 05 00 00

$17:80B8 38 C8 00

$17:80BB 40 A0 00

$17:80BE 30 01

$17:80C0 0F 00 01 00

$17:80C4 06 01

$17:80C6 07 8B 81 00

$17:80CA 01 10

$17:80CC 07 CB A0 00 //screen dimmer-increase, before 1st group of text

$17:80D0 06 01

$17:80D2 02

$17:80D3 09 6D 82 17 //A-Button press, 8D 82 = Arcana title screen

$17:80D7 07 CC D4 18 2B 81 17 00

$17:80DF 07 51 A0 00 91 10 FF 00 //stops here on 1st set text ???

$17:80E7 30 FF

$17:80E9 0F 00 FF FF

$17:80ED 07 CC D4 18 2B 82 17 00

$17:80F5 07 51 A0 00 91 10 FF 00

$17:80FD 06 F0

$17:80FF 07 83 82 17

$17:8103 01 10

$17:8105 07 DB A0 00 //screen dimmer-decrease, after 1st group of text

$17:8109 06 04

$17:810B 02

$17:810C 31 FF

$17:810E 07 CC D4 18 29 81 17 00

$17:8116 06 05

$17:8118 1A 8D 82 //8D 82 = Arcana title screen


To create the patch:

1. I copied all $17:804D-$17:811A data to $17:FF00

2. $00:A212  4D 80, was change to $00:A212  00 FF

3. $17:804F 11 02 55 80 8D 82, changed to $17:804F 11 02 08 FF 8D 82
   but this was for the copied data at the $17:FF00 ($17:FF04 80 8D)

4. Removed data at $17:80D3 09 6D 82 17 //A-Button press, 8D 82 = Arcana title screen
   but this was for the copied data at the $17:FF00 ($17:FF86 09 6D 82 17)