mirror of
https://github.com/TheOnlyZac/sly1.git
synced 2025-02-21 07:40:58 +00:00
Setup binary input stream functions
This commit is contained in:
parent
2ad6a36fb9
commit
c2488129f3
@ -92,7 +92,7 @@ segments:
|
||||
- [0x310e8, asm, P2/basic]
|
||||
- [0x31168, asm, P2/bez]
|
||||
- [0x31f48, c, P2/binoc]
|
||||
- [0x38290, asm, P2/bis]
|
||||
- [0x38290, c, P2/bis]
|
||||
- [0x395a0, asm, P2/bbmark]
|
||||
- [0x39ff0, asm, P2/blend]
|
||||
- [0x3ab70, asm, P2/blip]
|
||||
|
@ -58,6 +58,37 @@ SetVerticalJust__8CTextBox2JV = 0x137268; // type:func
|
||||
_GLOBAL_$I$InitBei__FP3BEIP3CLQffi = 0x137270; // type:func
|
||||
|
||||
|
||||
// P2/bis.c
|
||||
__18CBinaryInputStreamiPvi = 0x137290; // type:func
|
||||
DESTRUCTOR__CBinaryInputStream = 0x1372E0; // type:func
|
||||
FOpenSector__18CBinaryInputStreamUiUi = 0x137328; // type:func
|
||||
OpenMemory__18CBinaryInputStreamiPv = 0x137398; // type:func
|
||||
FOpenFile__18CBinaryInputStreamP13CFileLocation = 0x1373B0; // type:func
|
||||
Close__18CBinaryInputStream = 0x1373D0; // type:func
|
||||
DecrementCdReadLimit__18CBinaryInputStreami = 0x137480; // type:func
|
||||
PumpCd__18CBinaryInputStream = 0x137490; // type:func
|
||||
PumpHost__18CBinaryInputStream = 0x1377C0; // type:func
|
||||
Pump__18CBinaryInputStream = 0x137820; // type:func
|
||||
Decompress__18CBinaryInputStream = 0x1378A0; // type:func
|
||||
Read__18CBinaryInputStreamiPv = 0x137A60; // type:func
|
||||
Align__18CBinaryInputStreami = 0x137B60; // type:func
|
||||
U8Read__18CBinaryInputStream = 0x137B90; // type:func
|
||||
U16Read__18CBinaryInputStream = 0x137BE0; // type:func
|
||||
U32Read__18CBinaryInputStream = 0x137C40; // type:func
|
||||
S8Read__18CBinaryInputStream = 0x137CC0; // type:func
|
||||
S16Read__18CBinaryInputStream = 0x137D10; // type:func
|
||||
S32Read__18CBinaryInputStream = 0x137D78; // type:func
|
||||
F32Read__18CBinaryInputStream = 0x137DF8; // type:func
|
||||
ReadVector__18CBinaryInputStreamP6VECTOR = 0x137E70; // type:func
|
||||
ReadVector4__18CBinaryInputStreamP7VECTOR4 = 0x137E90; // type:func
|
||||
ReadMatrix__18CBinaryInputStreamP7MATRIX3 = 0x137EB0; // type:func
|
||||
ReadMatrix4__18CBinaryInputStreamP7MATRIX4 = 0x137F08; // type:func
|
||||
ReadGeom__18CBinaryInputStreamP4GEOM = 0x137FB0; // type:func
|
||||
ReadBspc__18CBinaryInputStreamP4GEOMP4BSPC = 0x138278; // type:func
|
||||
ReadVbsp__18CBinaryInputStreamPiPP4VBSP = 0x138398; // type:func
|
||||
ReadStringSw__18CBinaryInputStreamPPc = 0x1384A0; // type:func
|
||||
|
||||
|
||||
// P2/cd.c
|
||||
CdPath__FPcT0i = 0x140b60; // type:func
|
||||
|
||||
|
150
include/bis.h
150
include/bis.h
@ -1,16 +1,24 @@
|
||||
/**
|
||||
* @file bis.h
|
||||
*
|
||||
* @brief Binary Input Stream.
|
||||
*/
|
||||
#ifndef BIS_H
|
||||
#define BIS_H
|
||||
|
||||
#include "common.h"
|
||||
#include <prog.h>
|
||||
#include <vec.h>
|
||||
#include <mat.h>
|
||||
#include <geom.h>
|
||||
|
||||
typedef struct BSPC;
|
||||
typedef struct VBSP;
|
||||
|
||||
/**
|
||||
* @brief Binary Input Stream Kind
|
||||
* @brief Binary Input Stream Kind.
|
||||
*
|
||||
* Types of binary stream that can be opened
|
||||
* Types of binary stream that can be opened.
|
||||
*/
|
||||
enum BISK
|
||||
{
|
||||
@ -32,6 +40,13 @@ class CFileLocation
|
||||
// Also it maybe isn't supposed to be in this file.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Binary Input Stream Flags numeric type.
|
||||
*
|
||||
* Flags for the binary input stream.
|
||||
*/
|
||||
typedef int GRFBIS;
|
||||
|
||||
/**
|
||||
* @brief Binary Input Stream
|
||||
*
|
||||
@ -68,77 +83,105 @@ public:
|
||||
/**
|
||||
* @brief Constructs a new CBinaryInputStream.
|
||||
*
|
||||
* @param fileName Name of the file to open
|
||||
* @param fileName Name of the file to open.
|
||||
*
|
||||
* @todo Implement this constructor.
|
||||
*/
|
||||
CBinaryInputStream(const char *fileName); // Used for file object
|
||||
CBinaryInputStream(int cbSpool, void *pvSpool, GRFBIS grfbis);
|
||||
|
||||
/**
|
||||
* @brief Destroys the CBinaryInputStream.
|
||||
*/
|
||||
~CBinaryInputStream();
|
||||
|
||||
/**
|
||||
* @brief Opens the file at the given location.
|
||||
*
|
||||
* First checks if the file is open and the CD is available.
|
||||
*
|
||||
* @param pfl Pointer to the file location
|
||||
*
|
||||
* @retval 0 File is not open
|
||||
* @retval 1 File is open
|
||||
*/
|
||||
int FOpenFile(CFileLocation *pfl);
|
||||
|
||||
/**
|
||||
* @brief Opens the sector at the given location.
|
||||
*
|
||||
* @param isector Sector to open
|
||||
* @param cb Number of bytes to read
|
||||
* @param isector Sector to open.
|
||||
* @param cb Number of bytes to read.
|
||||
*
|
||||
* @retval 0 Sector is not open
|
||||
* @retval 1 Sector is open
|
||||
* @retval 0 Sector is not open.
|
||||
* @retval 1 Sector is open.
|
||||
*/
|
||||
int FOpenSector(uint32_t isector, uint32_t cb);
|
||||
int FOpenSector(uint isector, uint cb);
|
||||
|
||||
/**
|
||||
* @brief Opens a certain number of bytes in memory.
|
||||
*
|
||||
* @param cb Number of bytes to open
|
||||
* @param pv Pointer to the memory location
|
||||
* @param cb Number of bytes to open.
|
||||
* @param pv Pointer to the memory location.
|
||||
*/
|
||||
void OpenMemory(int cb, void *pv);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Opens the file at the given location.
|
||||
*
|
||||
* First checks if the file is open and the CD is available.
|
||||
*
|
||||
* @param pfl Pointer to the file location.
|
||||
*
|
||||
* @retval 0 File is not open.
|
||||
* @retval 1 File is open.
|
||||
*/
|
||||
int FOpenFile(CFileLocation *pfl);
|
||||
|
||||
/**
|
||||
* @brief Closes the stream.
|
||||
*/
|
||||
void Close();
|
||||
|
||||
/**
|
||||
* @brief Decrements the number of async bytes remaining.
|
||||
*
|
||||
* @param cb Number of bytes to decrement
|
||||
* @param cb Number of bytes to decrement.
|
||||
*/
|
||||
void DecrementCdReadLimit(int cb);
|
||||
|
||||
/**
|
||||
* @brief TBD.
|
||||
*/
|
||||
void PumpCd();
|
||||
|
||||
/**
|
||||
* @brief TBD.
|
||||
*/
|
||||
void PumpHost();
|
||||
|
||||
/**
|
||||
* @brief TBD.
|
||||
*/
|
||||
void Pump();
|
||||
|
||||
/**
|
||||
* @brief TBD.
|
||||
*/
|
||||
void Decompress();
|
||||
|
||||
/**
|
||||
* @brief Reads a certain number of bytes from the stream.
|
||||
*
|
||||
* Will read a certain number of bytes from the stream and store them at the
|
||||
* given location.
|
||||
*
|
||||
* @param cb Number of bytes to read
|
||||
* @param pv Pointer to the memory location
|
||||
* @param cb Number of bytes to read.
|
||||
* @param pv Pointer to the memory location.
|
||||
*/
|
||||
void Read(int cb, void *pv);
|
||||
|
||||
/**
|
||||
* @brief Aligns the stream to a certain number of bytes.
|
||||
*
|
||||
* @param n Number of bytes to align to
|
||||
* @param n Number of bytes to align to.
|
||||
*/
|
||||
void Align(int n);
|
||||
|
||||
// MARK: Read Methods
|
||||
|
||||
/**
|
||||
* @brief Reads a byte from the stream.
|
||||
*
|
||||
* @return The byte read
|
||||
* @return The byte read.
|
||||
*/
|
||||
byte U8Read();
|
||||
|
||||
@ -184,17 +227,58 @@ public:
|
||||
*/
|
||||
float F32Read();
|
||||
|
||||
/**
|
||||
* @brief Reads a vector from the stream.
|
||||
*
|
||||
* @param pv Pointer to the vector to store the data.
|
||||
*/
|
||||
float ReadVector(VECTOR *pvec);
|
||||
|
||||
/**
|
||||
* @brief Reads a 4D vector from the stream.
|
||||
*
|
||||
* @param pv Pointer to the vector to store the data.
|
||||
*/
|
||||
void ReadVector4(float *pvec);
|
||||
|
||||
/**
|
||||
* @brief Reads a matrix from the stream.
|
||||
*
|
||||
* @param pmat Pointer to the matrix to store the data.
|
||||
*/
|
||||
void ReadMatrix(MATRIX3 *pmat);
|
||||
|
||||
/**
|
||||
* @brief Reads a 4x4 matrix from the stream.
|
||||
*
|
||||
* @param pmat Pointer to the matrix to store the data.
|
||||
*/
|
||||
void ReadMatrix4(MATRIX4 *pmat);
|
||||
|
||||
/**
|
||||
* @brief Reads geometry data from the stream.
|
||||
*
|
||||
* @param pgeom Pointer to the geometry data structure to store the data.
|
||||
* @param pbspb Unknown.
|
||||
*
|
||||
* @todo Fix parse errors in function declaration.
|
||||
*/
|
||||
//void (GEOM *pgeom, BSPC *pbspc);
|
||||
|
||||
/**
|
||||
* @brief Reads the given number of VBSPs from the stream.
|
||||
*
|
||||
* @param pcvbsp Pointer to the number of VBSP data structures to read.
|
||||
* @param apvbsp Pointer to the array of VBSP data structures to store the data.
|
||||
*/
|
||||
void ReadVbsp(int *pcvbsp, VBSP **apvbsp);
|
||||
|
||||
/**
|
||||
* @brief Reads a string from the stream.
|
||||
*
|
||||
* @param pachz Pointer where the string will be stored
|
||||
*/
|
||||
void ReadStringSw(char **pachz);
|
||||
|
||||
/**
|
||||
* @brief Closes the stream.
|
||||
*/
|
||||
void Close();
|
||||
};
|
||||
|
||||
#endif // BIS_H
|
||||
|
65
src/P2/bis.c
Normal file
65
src/P2/bis.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include <bis.h>
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", __18CBinaryInputStreamiPvi);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", DESTRUCTOR__CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", FOpenSector__18CBinaryInputStreamUiUi);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", OpenMemory__18CBinaryInputStreamiPv);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", FOpenFile__18CBinaryInputStreamP13CFileLocation);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", Close__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", DecrementCdReadLimit__18CBinaryInputStreami);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", PumpCd__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", PumpHost__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", Pump__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", Decompress__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", Read__18CBinaryInputStreamiPv);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", Align__18CBinaryInputStreami);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", U8Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", U16Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", U32Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", func_00137CB8);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", S8Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", S16Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", S32Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", func_00137DF0);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", F32Read__18CBinaryInputStream);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadVector__18CBinaryInputStreamP6VECTOR);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadVector4__18CBinaryInputStreamP7VECTOR4);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadMatrix__18CBinaryInputStreamP7MATRIX3);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadMatrix4__18CBinaryInputStreamP7MATRIX4);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadGeom__18CBinaryInputStreamP4GEOM);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadBspc__18CBinaryInputStreamP4GEOMP4BSPC);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadVbsp__18CBinaryInputStreamPiPP4VBSP);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", ReadStringSw__18CBinaryInputStreamPPc);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", func_00138510);
|
||||
|
||||
INCLUDE_ASM(const s32, "P2/bis", func_00138550);
|
Loading…
x
Reference in New Issue
Block a user