Commit Graph

16 Commits

Author SHA1 Message Date
Luciano Ciccariello
9b9b3f649f
Custom debugging module (#108)
# What

Adds a custom debug menu. It is written in C and it is meant to replace
the Bat familar `SERVANT/TT_000.BIN`. Once loaded you can long-press
SELECT+START to soft-reset the game and keep using the debug menu
everywhere, including when playing with Richter or during the credits.

One key requirement to run this is to have an emulator that emulates the
8MB of RAM. This is a key requirement to have the debug module surviving
soft-resets or accessing to the in-game menu. I personally used [PCSX
Redux](https://github.com/grumpycoders/pcsx-redux) to build this module.
I am not sure about the compatibility with other emulators. This does
**NOT** work on real hardware and it is a choice by design. The debug
module is intended to test different areas of the game and help
decompiling. It is not intended to be used in normal gameplay.

# Build

Simply invoke `make disk_debug` to create a disk image of the game in
`build/` with the debug module replacing the Bat familiar.

# Usage


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/15a040b6-6191-41c4-b2b8-a4a906ed59eb)


On PCSX Redux go to Configuration, Emulation and tick the box `8MB`.

## Loading the module


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/65b7ccb3-800e-4b66-84f5-5703fc91babe)

You need to enable the Bat Card from the menu. This will load the debug
module from the disk. If you want to re-load the module you need to
select another Familar Card, un-pause, pause again and select the Bat
Card once more.

## The main screen


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/b528425a-ea6c-4c10-9c19-522612d0ad2a)

You will know you have loaded the debug module when you see the blue
rectangle on the top right. You can press R2 to cycle between the menus.
Some menus will temporarily freeze the game, some not. To quickly return
in-game you can either press TRIANGLE or START. To bring back the paused
debug menu just press R2 once again.

## Debug Mode


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/12cac1ee-725b-484f-8564-89c03b6a755b)

### Stage

Teleports the player to a different stage. It is not stable and it can
crash often.

### Player

Switches between Alucard and Richter. Currently switching from Richter
to Alucard consistently crashes the game.

### No Clip

Allows to freely move the player within the room and without the
collisions on. Once the flag is enabled from the debug menu, pressing L2
while in-game will temporarily freeze the player movement and make it
immune to collision checking. You can then press the directional buttons
to slowly move the player or you can hold CROSS to move it faster. You
can also use SQUARE or CIRCLE to cycle between the player frames. Press
L2 again to deactivate the NoClip mode.

### Frame by frame

Freezes the game outside the debug module. Press L1 to advance by 1
frame. Hold L2 to put the game in slow-motion.

### Show hitboxes


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/ea8dd918-cf37-4be1-bb87-541a66ac7f16)

As shown in the image

### Show debug messages


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/5c9bc7b2-6bc7-4831-949a-bf73cdf910e8)

When the debug menu is un-paused, prints on the top left all the debug
messages from the game itself.

### Show collision layer


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/959ad1ab-dfe0-42fe-a8d0-65c619469280)

This prints the internal collision value for every 16x16 tile on the
screen. Look the CheckCollision function for more information on how
each printed value is used.

### Show draw calls


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/a52970fc-bf30-430d-98e3-5fca33c9f6f7)

Shows the maximum GPU resource usage since the game started. Currently
only the `max` option works. The `current` option will not show
anything.

### Show HBlank


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/81759019-6bf9-4cf2-b88c-aa60eaa5ddcb)

Prints the current horizontal blank interrupt count.

## Entity Spawn


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/f0fdc024-4537-4c07-a80d-816d605a3583)

Allows to immediately spawn new entities in the current map

### Mode

There are three list of entities, each one with their own ID: DRA, Stage
and RIC. The option RIC is hidden if Richter is not the current playing
character. As the list of entities per stage is maintained manually,
stage entities might not be available for all stages. The `Alloc` shows
how many entities are reserved or actually used. Pressing the SQUARE
button here will destroy all the entities within that range.

### ID

Press Left or Right to cycle between the different IDs available. Some
of them might crash the game immediately once spawned. Press CROSS to
immediately spawn the entity.

### Params

Each entity might have its own parameters. Sometimes the flag 0x8000 is
used, which can be toggled with the SQUARE button. Press CROSS to
immediately spawn the entity.

### Entity preview

Shows the entity before spawning it. This is turned off by default as it
can immediately crash by cycling through the available entity IDs.

### Place entity

Pressing CROSS will allow to move the entity across the screen before
placing it. Press CROSS again to place the entity and return to the
previous screen. Press SQUARE to quickly place multiple entities of the
same type.

## Sound player


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/9d8ad3a5-bc78-4674-abd0-94537bbfae98)

There are three macro categories the sound player is split into. For
what is currently known only the sounds within the Kind 3 changes based
on the loaded stage.

### Stop all sounds

This will also disable the SPU IRQ, effectively unlocking the frame
rate.

### Load Stage

Loads a different sound font than the current loaded stage. This can
help to quickly preview and test SFXs from other stages without
necessarily moving the player there.

### Load Servant

Loads the sound font of a specific servant without necessarily equipping
the Familiar Card.

## Castle flags

Preview all the flags used to modify the behaviour of different parts of
the two castles.

### Edit mode


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/b03ada2f-0fb4-4345-ad50-81209702032c)

You can move the cursor with the directional buttons and flip the flag
with CROSS. Press L1 or R1 to cycle between the pages. The cursor warps
when reaching the border of the flag grid, allowing a faster navigation.

### View mode

Allows to move between the flags more flexibly.

### Listen mode


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/4f9ed118-d09d-4658-ba25-5865dbebbf3c)

Listens for the modified flags while playing. Every time a flag is
modified the offset and its value is registered on the top left up to 4
rows. When all the rows are occupied, new values will just remove the
oldest one. The last modified flag will always be displayed at the
bottom.

---------

Co-authored-by: Alejandro Asenjo Nitti <sonicdcer@users.noreply.github.com>
Co-authored-by: sozud <sozud@users.noreply.github.com>
2023-08-10 18:55:24 +01:00
Luciano Ciccariello
e954826b14 Remove shared VSCode settings 2023-03-16 12:31:37 +00:00
Luciano Ciccariello
137f4b80c2 Extract g_Rooms for all the overlays 2023-03-13 21:15:25 +00:00
Luciano Ciccariello
7004380fc4 Automatically format code on save 2023-03-13 20:24:53 +00:00
Luciano Ciccariello
d7417b7375 Change how game assets are managed 2023-02-21 23:25:31 +00:00
Luciano Ciccariello
8e9a742a71 sotn-disk: Fix CUE parsing on some edge scenario 2023-01-24 02:12:14 +00:00
Luciano Ciccariello
800832d7dd Decouple DRA to the rest of the overlays 2023-01-22 15:42:03 +00:00
Luciano Ciccariello
f8d96b5828 Trim settings.json 2023-01-12 18:59:14 +00:00
Luciano Ciccariello
cdffa4fbb6 Ignore tools when searching through VSCode 2022-12-21 06:37:24 +00:00
Alejandro Asenjo Nitti
0b0671f040
DRA functions + PSXSDK docs (#30)
Co-authored-by: @pixel-stuck, @Mr-Wiseguy, @Rainchus, @DavidSM64
2022-12-19 05:32:00 +00:00
Alejandro Asenjo Nitti
bdf251564d
Several DRA functions and Readme update (#29)
Co-authored-by the amazing people from the Decomp Discord server! @Rainchus @pixel-stuck @DavidSM64
2022-12-09 23:30:52 +00:00
Alejandro Asenjo
7738b214c8
macro.inc fixed, introducing sfx macros, object enums, several NZ0 functions (#27)
Co-authored-by: Formatting bot <xeeynamo@users.noreply.github.com>
2022-11-25 17:51:16 +00:00
Alejandro Asenjo
ab95f771a6
NZ0 (Alchemy Laboratory) Overlay extraction, functions migrated (#24) 2022-11-15 23:36:02 +00:00
Luciano Ciccariello
46a860b30b More menu matches 2022-10-23 18:38:07 +01:00
Alejandro Asenjo
4e173c0c2e
Fixed almost all warnings (#6)
There are a few that i couldn't wipe because of fake matching issues.
2022-10-17 10:19:23 +01:00
Alejandro Asenjo
4282d14fe0
vs code settings (#1) 2022-10-15 10:16:18 +01:00