name functions in src/core2/nc/cameranodelist.c

This commit is contained in:
Banjo Kazooie
2023-03-10 00:31:06 -06:00
parent f0af2d1620
commit 13728811aa
18 changed files with 357 additions and 346 deletions

View File

@@ -6,14 +6,14 @@
void func_8034AE08(Struct61s *arg0, void *arg1, s32 arg2);
void __file_read(Struct61s *file, void *arg1, s32 arg2);
/* .code */
void func_8034AAB0(Struct61s * arg0){
if(arg0->unk14 == 2){
assetcache_release(arg0->unk0);
void file_close(Struct61s * file){
if(file->unk14 == 2){
assetcache_release(file->unk0);
}
free(arg0);
free(file);
}
Struct61s *func_8034AAF4(enum asset_e asset_id) {
@@ -70,192 +70,192 @@ Struct61s *func_8034AC04(void){
return this;
}
void func_8034AC5C(Struct61s *arg0, void **arg1, s32 *size){
*size = ((u32)arg0->unkC - (u32)arg0->unk8);
*arg1 = realloc(arg0->unk8, *size);
arg0->unk8 = NULL;
func_8034AAB0(arg0);
void file_realloc(Struct61s *file, void **arg1, s32 *size){
*size = ((u32)file->unkC - (u32)file->unk8);
*arg1 = realloc(file->unk8, *size);
file->unk8 = NULL;
file_close(file);
}
void func_8034ACAC(Struct61s *arg0, u8 *arg1){
func_8034AE08(arg0, arg1, 1);
void file_getByte(Struct61s *file, u8 *arg1){
__file_read(file, arg1, 1);
}
void func_8034ACCC(Struct61s *arg0, u8 *arg1, s32 cnt){
void file_getNBytes(Struct61s *file, u8 *arg1, s32 cnt){
while(cnt > 0){
func_8034ACAC(arg0, arg1);
file_getByte(file, arg1);
cnt--;
arg1++;
}
}
void func_8034AD20(Struct61s *arg0, f32 *arg1){
func_8034AE08(arg0, arg1, 4);
void file_getFloat(Struct61s *file, f32 *arg1){
__file_read(file, arg1, 4);
}
void func_8034AD40(Struct61s *arg0, f32 *arg1, s32 cnt){
void file_getNFloat(Struct61s *file, f32 *arg1, s32 cnt){
while(cnt > 0){
func_8034AD20(arg0, arg1);
file_getFloat(file, arg1);
cnt--;
arg1++;
}
}
void func_8034AD94(Struct61s *arg0, s32 *arg1){
func_8034AE08(arg0, arg1, 4);
void file_getWord(Struct61s *file, s32 *arg1){
__file_read(file, arg1, 4);
}
void func_8034ADB4(Struct61s *arg0, s32 *arg1, s32 cnt){
void file_getNWords(Struct61s *file, s32 *arg1, s32 cnt){
while(cnt > 0){
func_8034AD94(arg0, arg1);
file_getWord(file, arg1);
cnt--;
arg1++;
}
}
void func_8034AE08(Struct61s *arg0, void *arg1, s32 arg2) {
void __file_read(Struct61s *file, void *dst, s32 len) {
u32 curr_offset;
u32 capacity;
u32 end_ptr;
u32 var_v0;
if (arg0->unk14 == 2) { //read asset
memcpy(arg1, arg0->unk4, arg2);
arg0->unk4 = (void *) ((u32)arg0->unk4 + arg2);
if (file->unk14 == 2) { //read asset
memcpy(dst, file->unk4, len);
file->unk4 = (void *) ((u32)file->unk4 + len);
}
else if (arg0->unk14 == 3) { //read bin???
memcpy(arg1, arg0->unkC, arg2);
arg0->unkC = (void *) ((u32)arg0->unkC + arg2);
else if (file->unk14 == 3) { //read bin???
memcpy(dst, file->unkC, len);
file->unkC = (void *) ((u32)file->unkC + len);
}
else if (arg0->unk14 == 4) { // write bin???
if ((u8*)arg0->unk10 < (u8*)arg0->unkC + arg2) {
curr_offset = (u8*)arg0->unkC - (u8*)arg0->unk8;
capacity = ((u8*)arg0->unk10 - (u8*)arg0->unk8)*2;
while (((u8*)arg0->unk8 + capacity) < (u8*)arg0->unkC + arg2) {
else if (file->unk14 == 4) { // write bin???
if ((u8*)file->unk10 < (u8*)file->unkC + len) {
curr_offset = (u8*)file->unkC - (u8*)file->unk8;
capacity = ((u8*)file->unk10 - (u8*)file->unk8)*2;
while (((u8*)file->unk8 + capacity) < (u8*)file->unkC + len) {
capacity *= 2;
}
var_v0 = realloc(arg0->unk8, capacity);
arg0->unk8 = var_v0;
arg0->unkC = var_v0 + curr_offset;
arg0->unk10 = var_v0 + capacity;
var_v0 = realloc(file->unk8, capacity);
file->unk8 = var_v0;
file->unkC = var_v0 + curr_offset;
file->unk10 = var_v0 + capacity;
}
memcpy(arg0->unkC, arg1, arg2);
arg0->unkC = (u32)arg0->unkC + arg2;
memcpy(file->unkC, dst, len);
file->unkC = (u32)file->unkC + len;
}
}
void func_8034AF24(Struct61s *arg0, s16 *arg1){
func_8034AE08(arg0, arg1, sizeof(s16));
void file_getShort(Struct61s *file, s16 *arg1){
__file_read(file, arg1, sizeof(s16));
}
void func_8034AF44(Struct61s *arg0, s16 *arg1, s32 cnt){
void file_getNShorts(Struct61s *file, s16 *arg1, s32 cnt){
while(cnt > 0){
func_8034AF24(arg0, arg1);
file_getShort(file, arg1);
cnt--;
arg1++;
}
}
bool func_8034AF98(Struct61s *arg0, s32 arg1) {
bool file_isNextByteExpected(Struct61s *file, s32 arg1) {
u8 sp1F;
sp1F = arg1;
if ((arg0->unk14 == 1) || (arg0->unk14 == 4)) {
func_8034ACAC(arg0, &sp1F);
if ((file->unk14 == 1) || (file->unk14 == 4)) {
file_getByte(file, &sp1F);
return 1;
}
if (arg0->unk7C == -1) {
func_8034ACAC(arg0, &sp1F);
if (file->unk7C == -1) {
file_getByte(file, &sp1F);
if (arg1 == sp1F) {
return 1;
}
arg0->unk7C = sp1F;
file->unk7C = sp1F;
return 0;
}
if (arg1 == arg0->unk7C) {
arg0->unk7C = -1;
if (arg1 == file->unk7C) {
file->unk7C = -1;
return 1;
}
return 0;
}
bool func_8034B040(Struct61s * arg0, s32 arg1, u8 *arg2){
if(!func_8034AF98(arg0, arg1)){
bool file_getByte_ifExpected(Struct61s * file, s32 arg1, u8 *arg2){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034ACAC(arg0, arg2);
file_getByte(file, arg2);
return TRUE;
}
}
bool func_8034B080(Struct61s * arg0, s32 arg1, u8 *arg2, s32 arg3){
if(!func_8034AF98(arg0, arg1)){
bool file_getNBytes_ifExpected(Struct61s * file, s32 arg1, u8 *arg2, s32 n){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034ACCC(arg0, arg2, arg3);
file_getNBytes(file, arg2, n);
return TRUE;
}
}
bool func_8034B0C8(Struct61s * arg0, s32 arg1, f32 *arg2){
if(!func_8034AF98(arg0, arg1)){
bool file_getFloat_ifExpected(Struct61s * file, s32 arg1, f32 *arg2){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034AD20(arg0, arg2);
file_getFloat(file, arg2);
return TRUE;
}
}
bool func_8034B108(Struct61s * arg0, s32 arg1, f32 *arg2, s32 arg3){
if(!func_8034AF98(arg0, arg1)){
bool file_getNFloats_ifExpected(Struct61s * file, s32 arg1, f32 *arg2, s32 n){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034AD40(arg0, arg2, arg3);
file_getNFloat(file, arg2, n);
return TRUE;
}
}
bool func_8034B150(Struct61s * arg0, s32 arg1, s32 *arg2){
if(!func_8034AF98(arg0, arg1)){
bool file_getWord_ifExpected(Struct61s * file, s32 arg1, s32 *arg2){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034AD94(arg0, arg2);
file_getWord(file, arg2);
return TRUE;
}
}
bool func_8034B190(Struct61s * arg0, s32 arg1, s32 *arg2, s32 arg3){
if(!func_8034AF98(arg0, arg1)){
bool file_getNWords_ifExpected(Struct61s * file, s32 arg1, s32 *arg2, s32 n){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034ADB4(arg0, arg2, arg3);
file_getNWords(file, arg2, n);
return TRUE;
}
}
bool func_8034B1D8(Struct61s * arg0, s32 arg1, void *arg2, s32 arg3){
if(!func_8034AF98(arg0, arg1)){
bool file_get_ifExpected(Struct61s * file, s32 arg1, void *dst, s32 size){
if(!file_isNextByteExpected(file, arg1)){
return FALSE;
} else{
func_8034AE08(arg0, arg2, arg3);
__file_read(file, dst, size);
return TRUE;
}
}
bool func_8034B220(Struct61s * arg0, s32 arg1, s16 *arg2){
if(!func_8034AF98(arg0, arg1)){
bool file_getShort_ifExpected(Struct61s * file, s32 expected, s16 *dst){
if(!file_isNextByteExpected(file, expected)){
return FALSE;
} else{
func_8034AF24(arg0, arg2);
file_getShort(file, dst);
return TRUE;
}
}
bool func_8034B260(Struct61s * arg0, s32 arg1, s16 *arg2, s32 arg3){
if(!func_8034AF98(arg0, arg1)){
bool file_getNShorts_ifExpected(Struct61s * file, s32 expected, s16 *dst, s32 n){
if(!file_isNextByteExpected(file, expected)){
return FALSE;
} else{
func_8034AF44(arg0, arg2, arg3);
file_getNShorts(file, dst, n);
return TRUE;
}
}