mirror of
https://codeberg.org/KeybadeBlox/JSRF-Decompilation.git
synced 2026-04-07 13:00:24 +03:00
Rename Smilebit library to MUSASHI
Strings in the .rdata portion of the Smilebit in-house library code suggest that this was its name, with its contents having names beginning with an M (whence MMATRIX, for example).
This commit is contained in:
parent
d7abbb79c0
commit
cbd63865e2
6 changed files with 5 additions and 5 deletions
66
decompile/src/MUSASHI/MMatrix.cpp
Normal file
66
decompile/src/MUSASHI/MMatrix.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/* JSRF Decompilation: Smilebit/MMatrix.cpp
|
||||
Smilebit's stack-based matrix math library.
|
||||
*/
|
||||
|
||||
#pragma code_seg("MMATRIX")
|
||||
#pragma bss_seg (".data" )
|
||||
|
||||
|
||||
#include "../XDK/CRT/stddef.h"
|
||||
#include "../XDK/Win32.h"
|
||||
#include "MMatrix.hpp"
|
||||
|
||||
|
||||
// Address: 0x00264C04
|
||||
Mat4 * * g_matricesHead;
|
||||
|
||||
// Address: 0x00264C08
|
||||
Mat4 * g_matrices[3];
|
||||
|
||||
|
||||
// Address: 0x001BB690
|
||||
// Status: matching
|
||||
HRESULT __stdcall initMatrices(unsigned const count) {
|
||||
/* Initialize the matrix stack with the given number of matrices.
|
||||
The requested number of matrices is rounded up to the nearest multiple of two.
|
||||
The initialized matrices are accessible through g_matrices.
|
||||
*/
|
||||
// Allocate matrices
|
||||
unsigned i = (count + 1) & 0xFFFFFFFE; // Round up
|
||||
Mat4 * const mats = (Mat4 *)VirtualAlloc(
|
||||
NULL,
|
||||
(i + 2) * sizeof *mats,
|
||||
MEM_COMMIT|MEM_RESERVE,
|
||||
PAGE_READWRITE
|
||||
);
|
||||
if (mats != NULL) {
|
||||
Mat4 * mat = mats + 2;
|
||||
|
||||
// Initialize each matrix to identity
|
||||
if (i > 0) for (; i > 0; i--) {
|
||||
float * entry = (float *)mat;
|
||||
|
||||
for (unsigned j = 0; j < sizeof *mat/sizeof *entry; j++) {
|
||||
*entry = 0;
|
||||
entry += 1;
|
||||
}
|
||||
|
||||
(*mat)[3].w = 1;
|
||||
(*mat)[2].z = 1;
|
||||
(*mat)[1].y = 1;
|
||||
(*mat)[0].x = 1;
|
||||
mat++;
|
||||
}
|
||||
|
||||
// Assign to g_matrices for later access
|
||||
mat = mats + 2;
|
||||
g_matrices[1] = mats;
|
||||
g_matrices[2] = mat;
|
||||
g_matrices[0] = mats;
|
||||
g_matricesHead = g_matrices + 2;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
14
decompile/src/MUSASHI/MMatrix.hpp
Normal file
14
decompile/src/MUSASHI/MMatrix.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/* JSRF Decompilation: Smilebit/MMatrix.hpp
|
||||
Smilebit's stack-based matrix math library.
|
||||
*/
|
||||
|
||||
#ifndef MMATRIX_HPP
|
||||
#define MMATRIX_HPP
|
||||
|
||||
#include "../XDK/D3D.h"
|
||||
|
||||
|
||||
// 4x4 matrix type
|
||||
typedef D3DVECTOR4 Mat4[4];
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue