Move src and include files to old_ dirs to make way for splat

This commit is contained in:
Zac 2024-06-25 18:44:06 +00:00 committed by GitHub
parent e62ecd8980
commit b5ada453b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
97 changed files with 159 additions and 143 deletions

View File

@ -77,15 +77,15 @@ cd scripts
## Building
Before building, you must split the ELF file using Splat. Run the following command to split the ELF:
The project can be compiled on Windows or Linux using `make`. It builds the executable `SCUS_971.98`.
Before building, you must split the ELF file using Splat. This is defined in the `Makefile` as the `extract` target:
```bash
python -m splat split config/sly1.yaml
make extract
```
This will create a new directory `splat` with the disassembled assembly code and generated C files. You can now build the project.
The project can be compiled on Windows or Linux using `make`. It builds the executable `SCUS_971.98`.
This will create a new directory `asm` with the disassembled assembly code and generated C files. You can now build the project:
```bash
make

View File

@ -10,8 +10,8 @@ options:
compiler: GCC
asm_path: asm
src_path: c
build_path: build
src_path: src
build_path: bin
find_file_boundaries: False
disasm_unknown: True
@ -153,7 +153,7 @@ segments:
- [0x83c18, asm, P2/lo]
- [0x84cc8, asm, P2/light]
- [0x86358, asm, P2/lookat]
- [0x86758, asm, P2/main]
- [0x86758, c, P2/main]
- [0x86c18, asm, P2/mark]
- [0x894c0, asm, P2/mat]
@ -243,7 +243,7 @@ segments:
#- [0x, asm, P2/ub]
#- [0x, asm, P2/ui]
- [0xeac78, asm, P2/update]
- [0xeb408, c, P2/util]
- [0xeb408, asm, P2/util]
- [0xec518, asm] #? unknown file
@ -277,12 +277,12 @@ segments:
#----------------------------------------
# Rodata
#----------------------------------------
- [0x118380, rodata]
#- [0x118380, rodata]
#----------------------------------------
# Data
#----------------------------------------
- [0x151580, data]
#- [0x151580, data]
- [0x17C200, databin]
- [0x1A20D0]

View File

@ -2,6 +2,5 @@
#define COMMON_H
#include "include_asm.h"
#include <types.h>
#endif /* COMMON_H */

View File

@ -7,4 +7,4 @@
.macro dlabel label
.global \label
\label:
.endm
.endm

7
old_include/common.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef COMMON_H
#define COMMON_H
#include "include_asm.h"
#include <types.h>
#endif /* COMMON_H */

122
old_src/P2/main.c Normal file
View File

@ -0,0 +1,122 @@
#include <main.h>
#include <spliceutils.h>
#include <gs.h>
#include <joy.h>
#include <clock.h>
#include <ui.h>
#include <game.h>
#include <update.h>
#include <sw.h>
#include <render.h>
#include <frm.h>
#include <transition.h>
#include <mpeg.h>
#include <wipe.h>
#include <phasemem.h>
#include <prog.h>
#include <stdio.h>
#include <stdlib.h>
#define BUILD_TITLE "Sly Cooper"
#define BUILD_YEAR __DATE__[7], __DATE__[8], __DATE__[9], __DATE__[10]
#define COPYRIGHT "Sly 1 Decompilation Team"
#define BUILD_ID __DATE__[0], __DATE__[1], __DATE__[2], (__DATE__[4] == ' ' ? '0' : __DATE__[4]), __DATE__[5], __TIME__[0], __TIME__[1], __TIME__[3], __TIME__[4]
#define BRX_VERSION "000"
#ifndef __BUILD_USER
#define __BUILD_USER "nobody"
#endif
int main(int cphzArgs, char* aphzArgs[])
{
// __main(); // from libgcc2
g_chpzArgs = cphzArgs;
g_aphzArgs = aphzArgs;
Startup();
while (true)
{
// Check if g_mpeg has an mpeg queued to be played
if ((g_mpeg.oid_1 != OID_Unknown) && (g_wipe.wipes != WIPES_Idle))
{
////FlushFrames(1);
g_mpeg.ExecuteOids();
}
// Check if g_transition has a pending transition
if (g_transition.m_fPending != 0)
{
////FlushFrames(1);
g_transition.Execute();
}
// Check AGAIN if g_mpeg has an mpeg queued (in case two were queued back-to-back)
if ((g_mpeg.oid_2 != OID_Unknown) && (g_wipe.wipes != WIPES_Idle))
{
////FlushFrames(1);
g_mpeg.ExecuteOids();
}
// Call update functions
UpdateJoy(&g_joy);
UpdateCodes();
////UpdateSave(&g_save);
UpdateUi(&g_ui);
UpdateGameState(g_clock.dt);
// Render and draw current frame
if (g_psw != NULL)
{
// Prepare to render frame
SetupCm(g_pcm);
OpenFrame();
MarkClockTick(&g_clock);
// This ends up calling UpdateSw down the line
void* pv = g_psw + 0x54;
if (pv != NULL)
{
////(*pv)(g_clock.dt);
}
// Render frame
RenderSw(g_psw, g_pcm);
RenderUi();
// Draw frame
DrawSw(g_psw, g_pcm);
DrawUi();
CloseFrame();
}
// Increment the global frame counter
g_cframe += 1;
}
}
void Startup()
{
#ifdef __DEBUG
printf("%s @ %c%c%c%c\n", BUILD_TITLE, BUILD_YEAR);
printf(" %s\n", COPYRIGHT);
printf("P2: %c%c%c%c%c.%c%c%c%c %s\n", BUILD_ID, __BUILD_USER);
printf("Brx: %s\n", BRX_VERSION);
#endif
CProg prog;
prog.Begin();
SetPhase(PHASE_Startup);
/* todo game systems should be started by iterating over s_StartupSampler and
calling each function, updating the progress along the way */
///StartupSplice();
StartupCodes();
// ...
prog.SetRemain(0);
prog.End();
ClearPhase(PHASE_Startup);
}

View File

@ -33,18 +33,18 @@ float GLimitAbs(float g, float absLimit)
return g;
}
INCLUDE_ASM(const s32, "P2/util", GSmooth);
//INCLUDE_ASM(const s32, "P2/util", GSmooth);
INCLUDE_ASM(const s32, "P2/util", GSmoothA);
INCLUDE_ASM(const s32, "P2/util", func_001EA720); // Part of GSmoothA
//INCLUDE_ASM(const s32, "P2/util", GSmoothA);
//INCLUDE_ASM(const s32, "P2/util", func_001EA720); // Part of GSmoothA
INCLUDE_ASM(const s32, "P2/util", RadSmooth);
//INCLUDE_ASM(const s32, "P2/util", RadSmooth);
INCLUDE_ASM(const s32, "P2/util", RadSmoothA);
//INCLUDE_ASM(const s32, "P2/util", RadSmoothA);
INCLUDE_ASM(const s32, "P2/util", PosSmooth);
//INCLUDE_ASM(const s32, "P2/util", PosSmooth);
INCLUDE_ASM(const s32, "P2/util", SmoothMatrix);
//INCLUDE_ASM(const s32, "P2/util", SmoothMatrix);
int NRandInRange(int nLow, int nHigh)
{
@ -118,10 +118,10 @@ int CSolveQuadratic(float a, float b, float c, float* ax)
ax[1] = -bOver2a - sqrtOver2a;
*ax = -bOver2a + sqrtOver2a;
return 2; // two solutions: (-b <EFBFBD> radical) / 2a
return 2; // two solutions: (-b ± radical) / 2a
}
INCLUDE_ASM(const s32, "P2/util", PrescaleClq);
//INCLUDE_ASM(const s32, "P2/util", PrescaleClq);
void CalculateSinCos(float angle, float *sin, float *cos)
{
@ -215,7 +215,7 @@ float GModPositive(float gDividend, float gDivisor)
return result;
}
INCLUDE_ASM(const s32, "P2/util", FitClq);
//INCLUDE_ASM(const s32, "P2/util", FitClq);
/**
* @note Matching 100%
@ -272,7 +272,8 @@ int SgnCompareG(float* pg1, float* pg2)
void Force(void *)
{
// This function is empty.
return;
}
INCLUDE_ASM(const s32, "P2/util", MinimizeRange);
INCLUDE_ASM(const s32, "P2/util", func_001EB458);
//INCLUDE_ASM(const s32, "P2/util", MinimizeRange);
//INCLUDE_ASM(const s32, "P2/util", func_001EB458);

View File

@ -1,122 +1,9 @@
#include <main.h>
#include <spliceutils.h>
#include <gs.h>
#include <joy.h>
#include <clock.h>
#include <ui.h>
#include <game.h>
#include <update.h>
#include <sw.h>
#include <render.h>
#include <frm.h>
#include <transition.h>
#include <mpeg.h>
#include <wipe.h>
#include <phasemem.h>
#include <prog.h>
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
#define BUILD_TITLE "Sly Cooper"
#define BUILD_YEAR __DATE__[7], __DATE__[8], __DATE__[9], __DATE__[10]
#define COPYRIGHT "Sly 1 Decompilation Team"
#define BUILD_ID __DATE__[0], __DATE__[1], __DATE__[2], (__DATE__[4] == ' ' ? '0' : __DATE__[4]), __DATE__[5], __TIME__[0], __TIME__[1], __TIME__[3], __TIME__[4]
#define BRX_VERSION "000"
INCLUDE_ASM(const s32, "P2/main", main);
#ifndef __BUILD_USER
#define __BUILD_USER "nobody"
#endif
INCLUDE_ASM(const s32, "P2/main", StartupVU0);
int main(int cphzArgs, char* aphzArgs[])
{
// __main(); // from libgcc2
INCLUDE_ASM(const s32, "P2/main", StartupVU1);
g_chpzArgs = cphzArgs;
g_aphzArgs = aphzArgs;
Startup();
while (true)
{
// Check if g_mpeg has an mpeg queued to be played
if ((g_mpeg.oid_1 != OID_Unknown) && (g_wipe.wipes != WIPES_Idle))
{
////FlushFrames(1);
g_mpeg.ExecuteOids();
}
// Check if g_transition has a pending transition
if (g_transition.m_fPending != 0)
{
////FlushFrames(1);
g_transition.Execute();
}
// Check AGAIN if g_mpeg has an mpeg queued (in case two were queued back-to-back)
if ((g_mpeg.oid_2 != OID_Unknown) && (g_wipe.wipes != WIPES_Idle))
{
////FlushFrames(1);
g_mpeg.ExecuteOids();
}
// Call update functions
UpdateJoy(&g_joy);
UpdateCodes();
////UpdateSave(&g_save);
UpdateUi(&g_ui);
UpdateGameState(g_clock.dt);
// Render and draw current frame
if (g_psw != NULL)
{
// Prepare to render frame
SetupCm(g_pcm);
OpenFrame();
MarkClockTick(&g_clock);
// This ends up calling UpdateSw down the line
void* pv = g_psw + 0x54;
if (pv != NULL)
{
////(*pv)(g_clock.dt);
}
// Render frame
RenderSw(g_psw, g_pcm);
RenderUi();
// Draw frame
DrawSw(g_psw, g_pcm);
DrawUi();
CloseFrame();
}
// Increment the global frame counter
g_cframe += 1;
}
}
void Startup()
{
#ifdef __DEBUG
printf("%s @ %c%c%c%c\n", BUILD_TITLE, BUILD_YEAR);
printf(" %s\n", COPYRIGHT);
printf("P2: %c%c%c%c%c.%c%c%c%c %s\n", BUILD_ID, __BUILD_USER);
printf("Brx: %s\n", BRX_VERSION);
#endif
CProg prog;
prog.Begin();
SetPhase(PHASE_Startup);
/* todo game systems should be started by iterating over s_StartupSampler and
calling each function, updating the progress along the way */
///StartupSplice();
StartupCodes();
// ...
prog.SetRemain(0);
prog.End();
ClearPhase(PHASE_Startup);
}
INCLUDE_ASM(const s32, "P2/main", Startup);