Add build support for sound overlay
This commit is contained in:
parent
8d918900e2
commit
703c10d442
|
|
@ -176,6 +176,9 @@ ninja.newline()
|
|||
ninja.rule("psyq_cc_44", "$psyq_cc_44_exe -quiet -O2 -G $gSize -g -Wall $in -o $out""", "Compile $in -> $out")
|
||||
ninja.newline()
|
||||
|
||||
ninja.rule("psyq_aspsx_assemble_44_overlays", "$psyq_aspsx_44_exe -q -G0 -s$overlay $in -o $out""", "Compile $in -> $out")
|
||||
ninja.newline()
|
||||
|
||||
ninja.rule("psyq_aspsx_assemble_44", "$psyq_aspsx_44_exe -q $in -o $out", "Assemble $in -> $out")
|
||||
ninja.newline()
|
||||
|
||||
|
|
@ -203,7 +206,6 @@ ninja.newline()
|
|||
ninja.rule("hash_check", f"{sys.executable} $src_dir/../build/compare.py $in", "Hash check $in")
|
||||
ninja.newline()
|
||||
|
||||
|
||||
def create_psyq_ini(sdkDir, psyqDir):
|
||||
data = ""
|
||||
with open(sdkDir + "/" + psyqDir + "/bin/psyq.ini.template", 'r') as file:
|
||||
|
|
@ -226,6 +228,32 @@ def get_files_recursive(path, ext):
|
|||
collectedFiles.append(os.path.join(r, file))
|
||||
return collectedFiles
|
||||
|
||||
def get_file_global_size(file):
|
||||
g0_list = [
|
||||
"/Equip/",
|
||||
"/Bullet/",
|
||||
"/Thing/",
|
||||
"/Okajima/",
|
||||
"item.c", # todo figure out if correct, why not all .c files in this dir ??
|
||||
"anime.c", # ditto
|
||||
"vibrate.c",
|
||||
"/Takabe/",
|
||||
"/libfs/",
|
||||
"demothrd.c",
|
||||
"Kojo/demothrd.c",
|
||||
"strctrl.c",
|
||||
"jimctrl.c",
|
||||
"memcard.c",
|
||||
"dgd.c",
|
||||
"sub_80060644.c",
|
||||
"sub_80060548.c"
|
||||
]
|
||||
|
||||
if any(i in file for i in g0_list):
|
||||
return "0"
|
||||
|
||||
return "8"
|
||||
|
||||
def gen_build_target(targetName):
|
||||
ninja.comment("Build target " + targetName)
|
||||
|
||||
|
|
@ -263,63 +291,33 @@ def gen_build_target(targetName):
|
|||
cTempOFile = cOFile.replace(".c", "_fixme.obj")
|
||||
cOFile = cOFile.replace(".c", ".obj")
|
||||
#print("Build step " + asmFile + " -> " + asmOFile)
|
||||
if cFile.find("mts/") == -1 and cFile.find("SD/") == -1:
|
||||
ninja.build(cPreProcHeadersFile, "psyq_c_preprocess_44_headers", cFile)
|
||||
ninja.build(cPreProcHeadersFixedFile, "header_deps", cPreProcHeadersFile)
|
||||
|
||||
ninja.build(cPreProcHeadersFile, "psyq_c_preprocess_44_headers", cFile)
|
||||
ninja.build(cPreProcHeadersFixedFile, "header_deps", cPreProcHeadersFile)
|
||||
|
||||
if "overlays/sound" in cFile:
|
||||
# Build overlay using PsyQ 4.4
|
||||
print("overlay:", cFile)
|
||||
|
||||
ninja.build(cPreProcFile, "psyq_c_preprocess_44", cFile, implicit=[cPreProcHeadersFixedFile])
|
||||
ninja.build([cAsmPreProcFile, cAsmPreProcFileDeps, cDynDepFile], "asm_include_preprocess_44", cPreProcFile)
|
||||
|
||||
g0 = False
|
||||
buildWithG0 = [
|
||||
"/Equip/",
|
||||
"/Bullet/",
|
||||
"/Thing/",
|
||||
"/Okajima/",
|
||||
"item.c", # todo figure out if correct, why not all .c files in this dir ??
|
||||
"vibrate.c",
|
||||
"anime.c", # ditto
|
||||
"/Takabe/",
|
||||
"/libfs/",
|
||||
"DG_ResetExtPaletteMakeFunc_800791E4.c", # Despite the name, this might be related to Takabe due to proximity?
|
||||
"DG_ResetPaletteEffect_80078FF8.c", # Same as above
|
||||
"DG_StorePaletteEffect_80078F30.c", # Same as above
|
||||
"demothrd.c",
|
||||
"sub_80037DB8.c",
|
||||
"Kojo/demothrd.c",
|
||||
"strctrl.c",
|
||||
"jimctrl.c",
|
||||
"memcard.c",
|
||||
"dgd.c",
|
||||
"sub_80060644.c",
|
||||
"sub_80060548.c",
|
||||
"breath.c"
|
||||
"sndtst.c"
|
||||
]
|
||||
|
||||
for item in buildWithG0:
|
||||
if cFile.find(item) != -1:
|
||||
g0 = True
|
||||
break
|
||||
if g0:
|
||||
# print("-G 0: " + cFile)
|
||||
ninja.build(cAsmFile, "psyq_cc_44", cAsmPreProcFile, variables= { "gSize": "0"})
|
||||
else:
|
||||
ninja.build(cAsmFile, "psyq_cc_44", cAsmPreProcFile, variables= { "gSize": "8"})
|
||||
ninja.build(cTempOFile, "psyq_aspsx_assemble_44", cAsmFile)
|
||||
ninja.build(cAsmFile, "psyq_cc_44", cAsmPreProcFile, variables= { "gSize": "0" }) # overlays must be build using -G0
|
||||
ninja.build(cTempOFile, "psyq_aspsx_assemble_44_overlays", cAsmFile, variables= { "overlay": "sound" })
|
||||
ninja.build(cOFile, "asm_include_postprocess", cTempOFile, implicit=[cAsmPreProcFileDeps, cDynDepFile], dyndep=cDynDepFile)
|
||||
|
||||
else:
|
||||
#print("43:" + cFile)
|
||||
ninja.build(cPreProcHeadersFile, "psyq_c_preprocess_44_headers", cFile)
|
||||
ninja.build(cPreProcHeadersFixedFile, "header_deps", cPreProcHeadersFile)
|
||||
elif "mts/" in cFile or "SD/" in cFile:
|
||||
# Build using PsyQ 4.3
|
||||
ninja.build(cPreProcFile, "psyq_c_preprocess_43", cFile, implicit=[cPreProcHeadersFixedFile])
|
||||
ninja.build([cAsmPreProcFile, cAsmPreProcFileDeps, cDynDepFile], "asm_include_preprocess_44", cPreProcFile)
|
||||
|
||||
#print("-G 0: " + cFile)
|
||||
ninja.build(cAsmFile, "psyq_cc_43", cAsmPreProcFile, variables= { "gSize": "0"})
|
||||
|
||||
ninja.build(cTempOFile, "psyq_aspsx_assemble_2_56", cAsmFile)
|
||||
ninja.build(cOFile, "asm_include_postprocess", cTempOFile, implicit=[cAsmPreProcFileDeps, cDynDepFile], dyndep=cDynDepFile)
|
||||
else:
|
||||
# Build using PsyQ 4.4
|
||||
ninja.build(cPreProcFile, "psyq_c_preprocess_44", cFile, implicit=[cPreProcHeadersFixedFile])
|
||||
ninja.build([cAsmPreProcFile, cAsmPreProcFileDeps, cDynDepFile], "asm_include_preprocess_44", cPreProcFile)
|
||||
ninja.build(cAsmFile, "psyq_cc_44", cAsmPreProcFile, variables= { "gSize": get_file_global_size(cFile) })
|
||||
ninja.build(cTempOFile, "psyq_aspsx_assemble_44", cAsmFile)
|
||||
ninja.build(cOFile, "asm_include_postprocess", cTempOFile, implicit=[cAsmPreProcFileDeps, cDynDepFile], dyndep=cDynDepFile)
|
||||
|
||||
linkerDeps.append(cOFile)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ TARGET_HASH = '4b8252b65953a02021486406cfcdca1c7670d1d1a8f3cf6e750ef6e360dc3a2f'
|
|||
TARGET_SOUND_HASH = '4173d0fcbc7bfcd477d2e0fa6810b509bf6392efb01fd58a7fa114f003849816'
|
||||
CACHED_GOOD_EXE = '_mgsi.matching.exe'
|
||||
OBJ_EXE = '../obj/_mgsi.exe'
|
||||
#OBJ_SOUND = '../obj/sound.bin'
|
||||
OBJ_SOUND = '../obj/sound.bin'
|
||||
FUNCTIONS_FILE = 'functions.txt'
|
||||
EXE_SIZE = 641024
|
||||
TEXT_SEG_OFFSET = 0x50B8
|
||||
|
|
@ -226,12 +226,12 @@ def main():
|
|||
if not os.path.exists(OBJ_EXE):
|
||||
print(OBJ_EXE, "doesn't exist")
|
||||
return
|
||||
#if not os.path.exists(OBJ_SOUND):
|
||||
# print(OBJ_SOUND, "doesn't exist")
|
||||
# return
|
||||
if not os.path.exists(OBJ_SOUND):
|
||||
print(OBJ_SOUND, "doesn't exist")
|
||||
return
|
||||
|
||||
exe_hash = sha256(OBJ_EXE)
|
||||
#sound_hash = sha256(OBJ_SOUND)
|
||||
sound_hash = sha256(OBJ_SOUND)
|
||||
|
||||
failed = False
|
||||
if exe_hash != TARGET_HASH:
|
||||
|
|
@ -243,11 +243,11 @@ def main():
|
|||
ok(OBJ_EXE)
|
||||
cache_good_exe()
|
||||
|
||||
# if sound_hash != TARGET_SOUND_HASH:
|
||||
# fail(OBJ_SOUND)
|
||||
# failed = True
|
||||
# else:
|
||||
# ok(OBJ_SOUND)
|
||||
if sound_hash != TARGET_SOUND_HASH:
|
||||
fail(OBJ_SOUND)
|
||||
failed = True
|
||||
else:
|
||||
ok(OBJ_SOUND)
|
||||
|
||||
if failed:
|
||||
sys.exit(1)
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ def fix_obj(obj_to_fix, output_obj, deps):
|
|||
name_chars[0] = overwritten_name_char
|
||||
name = bytes(name_chars)
|
||||
|
||||
assert code_start <= addr_num < psyq_start
|
||||
|
||||
source_obj = obj_with_name(deps, name.decode() + '.obj')
|
||||
if not source_obj:
|
||||
print('couldnt find source obj with name:', name.decode() )
|
||||
|
|
|
|||
|
|
@ -330,10 +330,8 @@ __program_bottom EQU $800C3208
|
|||
|
||||
; Output group to overlay file, limit the size to what we know the max to be (i.e don't overrun into 801FFF0)
|
||||
; sound.bin overlay
|
||||
; sound group org($800C3208), file("{{OBJ_DIR}}\sound.bin"), size(343544)
|
||||
; section .gcl, sound
|
||||
;
|
||||
; include "{{OBJ_DIR}}\overlays\sndtst.obj"
|
||||
; include "{{OBJ_DIR}}\overlays\sndtst_data.obj"
|
||||
sound group org($800C3208), file("{{OBJ_DIR}}\sound.bin"), size(343544)
|
||||
include "{{OBJ_DIR}}\overlays\sound\overlay.obj"
|
||||
include "{{OBJ_DIR}}\overlays\sound\Game\sndtst.obj"
|
||||
|
||||
regs pc=__SN_ENTRY_POINT
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@
|
|||
#define CHARA_SNAKE 0x21ca // GV_StrCode( "スネーク" )
|
||||
#define CHARA_DOOR 0xb997 // GV_StrCode( "ドア" )
|
||||
#define CHARA_ITEM 0x8767 // GV_StrCode( "アイテム" )
|
||||
#define CHARA_SNDTST 0x4efc
|
||||
|
||||
// Other charas shouldn't be needed for the main exe
|
||||
/*
|
||||
|
|
@ -418,7 +419,6 @@
|
|||
#define CHARA_SNOW 0x18e3 // 雪
|
||||
#define CHARA_SSTORM 0xa6f5
|
||||
#define CHARA_SNOWAREA 0x901e
|
||||
#define CHARA_SNDTST 0x4efc
|
||||
#define CHARA_MOVIE 0xfaa8,
|
||||
#define CHARA_SPHERE 0x73ea
|
||||
#define CHARA_SPHERE2 0xbee1
|
||||
|
|
|
|||
|
|
@ -17,10 +17,14 @@ typedef struct Work
|
|||
|
||||
extern GV_PAD GV_PadData_800B05C0[4];
|
||||
|
||||
const char aPlaying[] = "PLAYING";
|
||||
const char aPlayingSymbols[] = "-=O";
|
||||
const char aPlayingFormat[] = "%c %c :%d";
|
||||
const char aPlayingSymbols2[] = "-0=-";
|
||||
// Strings in overlays end up in the .data section for some reason
|
||||
// Either strings are declared like this, or the -fwritable-strings option is used
|
||||
char aPlaying[] = "PLAYING";
|
||||
char aPlayingSymbols[] = "-=O";
|
||||
char aPlayingFormat[] = "%c %c :%d";
|
||||
char aPlayingSymbols2[] = "-0=-";
|
||||
char aNoMenu[] = "NO MENU\n";
|
||||
char aSndtstC[] = "sndtst.c";
|
||||
|
||||
void SndtstRunScripts_800C3218( Work *work, int param_2 )
|
||||
{
|
||||
|
|
@ -154,7 +158,7 @@ int SndtstGetResources_800C352C( Work *work, int where, int name )
|
|||
{
|
||||
if ( !GCL_GetParam_80020968( 's' ) )
|
||||
{
|
||||
printf( "NO MENU\n" );
|
||||
printf( aNoMenu );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +171,7 @@ int SndtstGetResources_800C352C( Work *work, int where, int name )
|
|||
return 0;
|
||||
}
|
||||
|
||||
void * NewSndtst_800C3594( int name, int where, int argc, char **argv )
|
||||
GV_ACT * NewSndtst_800C3594( int name, int where, int argc, char **argv )
|
||||
{
|
||||
Work *work;
|
||||
|
||||
|
|
@ -176,7 +180,7 @@ void * NewSndtst_800C3594( int name, int where, int argc, char **argv )
|
|||
work = (Work *)GV_NewActor_800150E4( 3, sizeof( Work ) );
|
||||
if ( work != NULL )
|
||||
{
|
||||
GV_SetNamedActor_8001514C( &( work->actor ), ( TActorFunction )SndtstAct_800C32D8, NULL, "sndtst.c" );
|
||||
GV_SetNamedActor_8001514C( &( work->actor ), ( TActorFunction )SndtstAct_800C32D8, NULL, aSndtstC );
|
||||
if (SndtstGetResources_800C352C( work, where, name ) < 0)
|
||||
{
|
||||
GV_DestroyActor_800151C8( (GV_ACT *)work );
|
||||
|
|
@ -184,5 +188,5 @@ void * NewSndtst_800C3594( int name, int where, int argc, char **argv )
|
|||
}
|
||||
}
|
||||
|
||||
return work;
|
||||
return &( work->actor );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _SNDTST_H_
|
||||
#define _SNDTST_H_
|
||||
|
||||
#include "libgv/libgv.h"
|
||||
|
||||
GV_ACT * NewSndtst_800C3594( int name, int where, int argc, char **argv );
|
||||
|
||||
#endif // _SNDTST_H_
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#include "Game/sndtst.h"
|
||||
#include "libgcl/hash.h"
|
||||
#include "libgcl/libgcl.h"
|
||||
|
||||
const GCL_ActorTableEntry OverlayEntries_800C3208[] = {
|
||||
{CHARA_SNDTST, NewSndtst_800C3594},
|
||||
{0, 0}
|
||||
};
|
||||
Loading…
Reference in New Issue