Skip to content

Commit

Permalink
Decompile 0100bc_sound.c 🥳
Browse files Browse the repository at this point in the history
  • Loading branch information
lhsazevedo committed Apr 30, 2024
1 parent 7673f1c commit e129943
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 32 deletions.
1 change: 1 addition & 0 deletions build/lnk_template.sub
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ input build\output\03bd80_sectionD.obj
input build\output\0fcd20_sectionB.obj

input build\output\scif.obj
input build\output\serial_debug.obj

; USER LIBS
library @DC_SDK@\shinobi\lib\cri_adxs.lib
Expand Down
3 changes: 2 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rm -rf build/output
mkdir build/output

compile src/010080_main.c
assemble src/asm/0100bc_sound.src
compile src/0100bc_sound.c
compile src/010e90.c
assemble src/asm/010fe8_unused.src
compile src/011120_asset_queues.c
Expand Down Expand Up @@ -100,6 +100,7 @@ assemble src/asm/03bd80_sectionD.src
assemble src/asm/0fcd20_sectionB.src

compile src/scif.c
compile src/serial_debug.c

wine $SHC_BIN/lnk.exe -sub=build\\lnk.sub

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_matching.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mkdir build/output

assemble src/asm/010000.src
compile src/010080_main.c
assemble src/asm/0100bc_sound.src
assemble src/asm/decompiled/0100bc_sound.src
compile src/010e90.c
assemble src/asm/010fe8_unused.src
assemble src/asm/decompiled/011120_asset_queues.src
Expand Down
26 changes: 22 additions & 4 deletions scripts/run_tests.docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,32 @@ rm -rf build/output
mkdir build/output

# 0100bc_sound
assemble src/asm/0100bc_sound.src
compile src/non_matching/_000188_8c0100bc_sound.c
assemble src/asm/decompiled/0100bc_sound.src
compile src/0100bc_sound.c

$sh4objtest "tests/0100bc_sound/0100bc_initUknVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/0100bc_initUknVol.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/0100bc_initUknVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010128_midiSetVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010128_midiSetVol.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010128_midiSetVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/0102d8_FUN.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/0102d8_FUN.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010972_setAdxVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010972_setAdxVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010c2c_FUN.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010c2c_FUN.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010cd6_snd.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010cd6_snd.php" "build/output/0100bc_sound_c.obj"

# 015ab8_title
assemble src/asm/decompiled/015ab8_title.src
Expand Down
20 changes: 10 additions & 10 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@ rm -rf build/output
mkdir build/output

# 0100bc_sound
assemble src/asm/0100bc_sound.src
compile src/non_matching/_000188_8c0100bc_sound.c
assemble src/asm/decompiled/0100bc_sound.src
compile src/0100bc_sound.c

$sh4objtest "tests/0100bc_sound/0100bc_initUknVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/0100bc_initUknVol.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/0100bc_initUknVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010128_midiSetVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010128_midiSetVol.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010128_midiSetVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/0102d8_FUN.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/0102d8_FUN.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/0102d8_FUN.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010972_setAdxVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010972_setAdxVol.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010972_setAdxVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010c2c_FUN.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010c2c_FUN.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010c2c_FUN.php" "build/output/0100bc_sound_c.obj"

$sh4objtest "tests/0100bc_sound/010cd6_snd.php" "build/output/0100bc_sound_src.obj"
$sh4objtest "tests/0100bc_sound/010cd6_snd.php" "build/output/_000188_8c0100bc_sound_c.obj"
$sh4objtest "tests/0100bc_sound/010cd6_snd.php" "build/output/0100bc_sound_c.obj"

# 015ab8_title
assemble src/asm/decompiled/015ab8_title.src
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/011120_asset_queues.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <shinobi.h>
#include <string.h>
#include "definitions.h"
#include "serial_debug.h"
#include "014a9c_tasks.h"
#include "stdio.h"

Expand Down
2 changes: 1 addition & 1 deletion src/012f44.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <shinobi.h>
#include <njdef.h>
#include "includes.h"
#include "definitions.h"
#include "serial_debug.h"
#include "014a9c_tasks.h"
#include "015ab8_title.h"
#include "scif.h"
Expand Down
2 changes: 1 addition & 1 deletion src/015ab8_title.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <sg_sd.h>
#include "014a9c_tasks.h"
#include "015ab8_title.h"
#include "definitions.h"
#include "serial_debug.h"

extern Bool getUknPvmBool_8c01432a();
extern void freeQueues_8c011f7e();
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions src/serial_debug.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdarg.h>
#include "scif.h"

#if defined(SERIAL_DEBUG)
void serialprintf(const char *fmt, ...) {
char buf[256];

va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args);
scif_puts(buf);
va_end(args);
}
#endif
15 changes: 2 additions & 13 deletions src/definitions.h → src/serial_debug.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include <stdarg.h>
#include "scif.h"

#ifndef _DEFINITIONS_H_
#define _DEFINITIONS_H_

Expand All @@ -25,16 +22,8 @@
#define DEBUG_LEVEL LOG_LEVEL_TRACE
#endif

#ifdef SERIAL_DEBUG
void serialprintf(const char *fmt, ...) {
char buf[256];

va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args);
scif_puts(buf);
va_end(args);
}
#if defined(SERIAL_DEBUG)
void serialprintf(const char *fmt, ...);
#endif

#if defined(SERIAL_DEBUG) && DEBUG_LEVEL >= LOG_LEVEL_FATAL
Expand Down

0 comments on commit e129943

Please sign in to comment.