diff --git a/config/symbol_addrs.txt b/config/symbol_addrs.txt index 22e2db3c..7e38bee4 100644 --- a/config/symbol_addrs.txt +++ b/config/symbol_addrs.txt @@ -16,6 +16,12 @@ _GLOBAL_$I$g_splotheapPair = 0x11C0E8; // type:func _GLOBAL_$D$g_splotheapPair = 0x11C108; // type:func +// P2/989snd.c +snd_StreamSafeCdBreak = 0x11e2a0; // type:func +snd_SendIOPCommandAndWait = 0x11e6b8; // type:func +snd_SendIOPCommandNoWait = 0x11e8c8; // type:func + + // P2/binoc.c InitBei = 0x130F48; // type:func GEvaluateBei = 0x131000; // type:func @@ -657,6 +663,14 @@ EnableCamera__FP6CAMERA = 0x1F4ED0; // type:func __main__Fv = 0x1fae18; // type:func +// sce/eecdvd.c +sceCdBreak = 0x203e28; // type:func + + +// sce/filestub.c +sceClose = 0x1f8c38; // type:func + + // sce/rand.c srand = 0x1F66F8; // type:func rand = 0x1F6708; // type:func diff --git a/include/989snd.h b/include/989snd.h index 0191f999..0f9f28b1 100644 --- a/include/989snd.h +++ b/include/989snd.h @@ -3,11 +3,28 @@ * * @brief 989snd sound driver. */ -#ifndef 989SND_H -#define 989SND_H +#ifndef SND989_H +#define SND989_H #include "common.h" -// ... +extern "C" +{ + struct sceCdRMode + { + uchar trycount; + uchar spindlctrl; + uchar datapattern; + uchar pad; + }; -#endif // 989SND_H + uint snd_SendIOPCommandAndWait(int command, int data_used, int *in_data); + uint snd_SendIOPCommandNoWait(int command, int data_used, uchar *done, ulong u_data); + int snd_StreamSafeCheckCdIdle(int fBlockEeIop); + int snd_StreamSafeCdRead(uint lbn, uint sectors, void *buf, sceCdRMode *mode); + int snd_StreamSafeCdSync(int mode); + int snd_StreamSafeCdBreak(); + int snd_StreamSafeCdGetError(); +} + +#endif // SND989_H diff --git a/include/bis.h b/include/bis.h index e9e0b0e5..beb44a0a 100644 --- a/include/bis.h +++ b/include/bis.h @@ -50,9 +50,9 @@ public: byte *m_abSpool; int m_cbSpool; int m_cbFile; - int m_cbRemaining; // File Stream Remaining Bytes. - byte *m_pb; // File Stream Position - int m_cb; // File Stream Size + int m_cbRemaining; /* File Stream Remaining Bytes. */ + byte *m_pb; /* File Stream Position */ + int m_cb; /* File Stream Size */ byte *m_pbRaw; int m_cbRaw; int m_grfDecomp; @@ -64,7 +64,7 @@ public: int m_cbAsyncRequest; int m_cbAsyncRemaining; int m_cbPartialRead; - uint m_isector; // Sector Offset in ISO + uint32_t m_isector; /* Sector Offset in ISO */ int m_cbuf; int m_cbufFill; int m_ibufMic; diff --git a/include/sce/eedvd.h b/include/sce/eedvd.h new file mode 100644 index 00000000..92304191 --- /dev/null +++ b/include/sce/eedvd.h @@ -0,0 +1,14 @@ +/** + * @file filestub.h + */ +#ifndef EEDVD_H +#define EEDVD_H + +#include "common.h" + +extern "C" +{ + int sceCdBreak(); +}; + +#endif // EEDVD_H diff --git a/include/sce/filestub.h b/include/sce/filestub.h new file mode 100644 index 00000000..4ce36a8e --- /dev/null +++ b/include/sce/filestub.h @@ -0,0 +1,14 @@ +/** + * @file filestub.h + */ +#ifndef FILESTUB_H +#define FILESTUB_H + +#include "common.h" + +extern "C" +{ + int sceClose(); +}; + +#endif // FILESTUB_H diff --git a/include/sce/gs.h b/include/sce/gs.h index e944aada..f3b72266 100644 --- a/include/sce/gs.h +++ b/include/sce/gs.h @@ -8,16 +8,19 @@ #include "common.h" -struct sceGsTex0 +extern "C" { - undefined4 unk_0x0; - undefined4 unk_0x4; -}; + struct sceGsTex0 + { + undefined4 unk_0x0; + undefined4 unk_0x4; + }; -struct sceGsTex2 -{ - undefined4 unk_0x0; - undefined4 unk_0x4; -}; + struct sceGsTex2 + { + undefined4 unk_0x0; + undefined4 unk_0x4; + }; +} #endif // GS_H diff --git a/include/sce/rand.h b/include/sce/rand.h index 34228025..7f5b84aa 100644 --- a/include/sce/rand.h +++ b/include/sce/rand.h @@ -8,37 +8,46 @@ #include "common.h" -struct RNG { - undefined4 field0_0x0; - undefined4 field1_0x4; - undefined4 field2_0x8; - undefined4 field3_0xc; - undefined4 field4_0x10; - undefined4 field5_0x14; - undefined4 field6_0x18; - undefined4 field7_0x1c; - undefined4 field8_0x20; - undefined4 field9_0x24; - undefined4 field10_0x28; - undefined4 field11_0x2c; - undefined4 field12_0x30; - undefined4 field13_0x34; - undefined4 field14_0x38; - undefined4 field15_0x3c; - undefined4 field16_0x40; - undefined4 field17_0x44; - undefined4 field18_0x48; - undefined4 field19_0x4c; - undefined4 field20_0x50; - undefined4 field21_0x54; - uint next; +extern "C" +{ + struct RNG { + undefined4 field0_0x0; + undefined4 field1_0x4; + undefined4 field2_0x8; + undefined4 field3_0xc; + undefined4 field4_0x10; + undefined4 field5_0x14; + undefined4 field6_0x18; + undefined4 field7_0x1c; + undefined4 field8_0x20; + undefined4 field9_0x24; + undefined4 field10_0x28; + undefined4 field11_0x2c; + undefined4 field12_0x30; + undefined4 field13_0x34; + undefined4 field14_0x38; + undefined4 field15_0x3c; + undefined4 field16_0x40; + undefined4 field17_0x44; + undefined4 field18_0x48; + undefined4 field19_0x4c; + undefined4 field20_0x50; + undefined4 field21_0x54; + uint next; + }; + + /** + * @brief Seed the random number generator. + */ + void srand(uint seed); + + /** + * @brief Generate a random number. + */ + uint rand(); + + extern struct RNG g_rng; + extern struct RNG *g_prng; }; -extern "C" void srand(uint seed); - -extern "C" uint rand(); - -extern struct RNG g_rng; -extern struct RNG *g_prng; - #endif // RAND_H diff --git a/src/P2/bis.c b/src/P2/bis.c index e21df933..1b5b0ceb 100644 --- a/src/P2/bis.c +++ b/src/P2/bis.c @@ -1,4 +1,5 @@ #include +#include <989snd.h> INCLUDE_ASM(const s32, "P2/bis", __18CBinaryInputStreamiPvi); @@ -51,7 +52,9 @@ int CBinaryInputStream::FOpenFile(CFileLocation *pfl) INCLUDE_ASM(const s32, "P2/bis", Close__18CBinaryInputStream); -INCLUDE_ASM(const s32, "P2/bis", DecrementCdReadLimit__18CBinaryInputStreami); +void CBinaryInputStream::DecrementCdReadLimit(int cb) { + m_fd = m_fd - cb; +} INCLUDE_ASM(const s32, "P2/bis", PumpCd__18CBinaryInputStream);