mirror of
https://github.com/xbret/xenoblade.git
synced 2025-02-17 04:49:34 +00:00
Looks like *that* was deallocate all along lol
This commit is contained in:
parent
3311fc86a6
commit
436c770d87
@ -32639,7 +32639,7 @@ getRegionIndex2_2__Q23mtl10MemManagerFv = .text:0x804343A8; // type:function siz
|
||||
deleteRegion__Q23mtl10MemManagerFi = .text:0x804343B0; // type:function size:0x7C scope:global align:4
|
||||
func_8043442C__Q23mtl10MemManagerFiUlUl = .text:0x8043442C; // type:function size:0x24 scope:global align:4
|
||||
func_80434450__Q23mtl10MemManagerFiUlUl = .text:0x80434450; // type:function size:0x88 scope:global align:4
|
||||
func_804344D8__Q23mtl10MemManagerFPv = .text:0x804344D8; // type:function size:0x1C8 scope:global align:4
|
||||
deallocate__Q23mtl10MemManagerFPv = .text:0x804344D8; // type:function size:0x1C8 scope:global align:4
|
||||
func_804346A0__Q23mtl10MemManagerFi = .text:0x804346A0; // type:function size:0x1C scope:global align:4
|
||||
func_804346BC__Q23mtl10MemManagerFi = .text:0x804346BC; // type:function size:0x48 scope:global align:4
|
||||
func_80434704__Q23mtl6RegionFUlUlPUl = .text:0x80434704; // type:function size:0x6C scope:global align:4
|
||||
|
@ -117,7 +117,7 @@ namespace mtl{
|
||||
static bool deleteRegion(int regionIndex);
|
||||
static void* func_8043442C(int regionIndex, u32 r4, u32 r5);
|
||||
static void func_80434450(int regionIndex, u32 r4, u32 r5);
|
||||
static void func_804344D8(void* r3);
|
||||
static void deallocate(void* r3);
|
||||
static u32 func_804346A0(int regionIndex);
|
||||
static void func_804346BC(int regionIndex);
|
||||
static void func_80434770(int regionIndex);
|
||||
@ -222,53 +222,6 @@ namespace mtl{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static inline void deallocate(void* p){
|
||||
if(p != nullptr){
|
||||
if(regionIndex1 != -1){
|
||||
MemBlock* entryToDelete = MemBlock::fromVoidPointer(p);
|
||||
Region* region = MemManager::getRegion(entryToDelete->regionIndex);
|
||||
|
||||
//this doesn't seem right
|
||||
if(entryToDelete->size - sizeof(MemBlock) - 1 > 0x7FFFFFF - sizeof(MemBlock) - 1){
|
||||
log(true); //Since monolithsoft removed their log function, this calls the math log lol
|
||||
return;
|
||||
}
|
||||
|
||||
region->mFreeBytes += entryToDelete->size;
|
||||
|
||||
//Remove the entry from the linked list
|
||||
if(entryToDelete->prev != nullptr){
|
||||
entryToDelete->prev->next = entryToDelete->next;
|
||||
}
|
||||
if(entryToDelete->next != nullptr) {
|
||||
entryToDelete->next->prev = entryToDelete->prev;
|
||||
}
|
||||
|
||||
if (region->unk8 == entryToDelete) {
|
||||
region->unk8 = entryToDelete->next;
|
||||
}
|
||||
|
||||
if (region->unkC == entryToDelete) {
|
||||
region->unkC = entryToDelete->prev;
|
||||
}
|
||||
|
||||
MemBlock* entry = region->func_804339B8(entryToDelete);
|
||||
entry = region->unkInline1(entry);
|
||||
|
||||
if (entry != nullptr) {
|
||||
entry = region->unkInline1(entry);
|
||||
|
||||
if (entry != NULL) {
|
||||
region->func_80433AA8(entry);
|
||||
}
|
||||
}
|
||||
|
||||
region->unk18--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: is there a way to have this be a normal array without generating sinit stuff?
|
||||
static u8 regionArray[MAX_REGIONS * sizeof(Region)];
|
||||
static s32 lbl_80667E50;
|
||||
|
@ -30,7 +30,7 @@ CPackItem::CPackItem(const char* name, UNKWORD r5) : unk4(), pkbFilename() {
|
||||
|
||||
CPackItem::~CPackItem(){
|
||||
if(mFileHandle != nullptr){
|
||||
CDeviceFile::func_8044F118((CFileHandle*)mFileHandle);
|
||||
CDeviceFile::func_8044F118(mFileHandle);
|
||||
}
|
||||
|
||||
if(unk79 != 0){
|
||||
@ -38,12 +38,12 @@ CPackItem::~CPackItem(){
|
||||
}
|
||||
|
||||
if(mPackHeader != nullptr){
|
||||
mtl::MemManager::func_804344D8((void*)mPackHeader);
|
||||
mtl::MemManager::deallocate((void*)mPackHeader);
|
||||
mPackHeader = nullptr;
|
||||
}
|
||||
|
||||
if(mAhxAdxDataPtr != nullptr){
|
||||
mtl::MemManager::func_804344D8((void*)mAhxAdxDataPtr);
|
||||
mtl::MemManager::deallocate((void*)mAhxAdxDataPtr);
|
||||
mAhxAdxDataPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace ml{
|
||||
}
|
||||
|
||||
const char* CPathUtil::getFileExtensionFromPath(const char* str){
|
||||
int endIndex = strlen(str) - 1;
|
||||
int endIndex = std::strlen(str) - 1;
|
||||
|
||||
for(int i = endIndex; i >= 0; i--) {
|
||||
char c = str[i];
|
||||
@ -49,32 +49,30 @@ namespace ml{
|
||||
param_2 = getFilenameFromPath(param_2);
|
||||
|
||||
if (param_2 == nullptr) {
|
||||
sVar2 = strlen(temp.string);
|
||||
param_1->size = sVar2;
|
||||
strcpy(param_1->string, temp.string);
|
||||
param_1->length = std::strlen(temp.string);
|
||||
std::strcpy(param_1->string, temp.string);
|
||||
}else {
|
||||
local_28 = strlen(param_2);
|
||||
strcpy(temp.string, param_2);
|
||||
local_28 = std::strlen(param_2);
|
||||
std::strcpy(temp.string, param_2);
|
||||
|
||||
sVar2 = getFilenameLengthWithoutExtension(temp.string, local_28);
|
||||
|
||||
if (sVar2 + 1 < 2) {
|
||||
sVar2 = strlen(temp.string);
|
||||
param_1->size = sVar2;
|
||||
strcpy(param_1->string,temp.string);
|
||||
param_1->length = std::strlen(temp.string);
|
||||
std::strcpy(param_1->string,temp.string);
|
||||
} else {
|
||||
param_1->string[0] = 0;
|
||||
param_1->size = 0;
|
||||
param_1->length = 0;
|
||||
|
||||
if (local_28 != 0) {
|
||||
if (sVar2 == -1) {
|
||||
sVar2 = local_28;
|
||||
}
|
||||
|
||||
strncpy(param_1->string,temp.string,sVar2);
|
||||
std::strncpy(param_1->string,temp.string,sVar2);
|
||||
param_1->string[sVar2] = 0;
|
||||
sVar2 = strlen(param_1->string);
|
||||
param_1->size = sVar2;
|
||||
sVar2 = std::strlen(param_1->string);
|
||||
param_1->length = sVar2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,9 +92,9 @@ namespace ml{
|
||||
char acStack_40 [16];
|
||||
size_t local_30;
|
||||
|
||||
sVar3 = strlen("");
|
||||
param_1->size = sVar3;
|
||||
strcpy(param_1->string, "");
|
||||
sVar3 = std::strlen("");
|
||||
param_1->length = sVar3;
|
||||
std::strcpy(param_1->string, "");
|
||||
|
||||
for (iVar6 = 0; iVar6 < param_3; iVar6++) {
|
||||
iVar4 = 1;
|
||||
@ -130,16 +128,16 @@ namespace ml{
|
||||
}
|
||||
|
||||
local_58[0] = (u16)(u8)((char)((param_2 % (iVar4 * 10))) + 0x30) << 8;
|
||||
local_30 = strlen((char *)local_58);
|
||||
strcpy(acStack_40,(char *)local_58);
|
||||
local_44 = strlen(acStack_40);
|
||||
strcpy(acStack_54,acStack_40);
|
||||
sVar3 = strlen(param_1->string);
|
||||
strcat(acStack_54,param_1->string);
|
||||
local_30 = std::strlen((char *)local_58);
|
||||
std::strcpy(acStack_40,(char *)local_58);
|
||||
local_44 = std::strlen(acStack_40);
|
||||
std::strcpy(acStack_54,acStack_40);
|
||||
sVar3 = std::strlen(param_1->string);
|
||||
std::strcat(acStack_54,param_1->string);
|
||||
local_44 = local_44 + sVar3;
|
||||
sVar3 = strlen(acStack_54);
|
||||
param_1->size = sVar3;
|
||||
strcpy(param_1->string,acStack_54);
|
||||
sVar3 = std::strlen(acStack_54);
|
||||
param_1->length = sVar3;
|
||||
std::strcpy(param_1->string,acStack_54);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -260,13 +260,56 @@ namespace mtl{
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemManager::func_8043442C(int regionIndex, u32 r4, u32 r5){
|
||||
void* MemManager::func_8043442C(int regionIndex, u32 r4, u32 r5){
|
||||
}
|
||||
|
||||
void MemManager::func_80434450(int regionIndex, u32 r4, u32 r5){
|
||||
}
|
||||
|
||||
void MemManager::func_804344D8(void* r3){
|
||||
void MemManager::deallocate(void* p){
|
||||
if(p != nullptr){
|
||||
if(regionIndex1 != -1){
|
||||
MemBlock* entryToDelete = MemBlock::fromVoidPointer(p);
|
||||
Region* region = MemManager::getRegion(entryToDelete->regionIndex);
|
||||
|
||||
//this doesn't seem right
|
||||
if(entryToDelete->size - sizeof(MemBlock) - 1 > 0x7FFFFFF - sizeof(MemBlock) - 1){
|
||||
log(true); //Since monolithsoft removed their log function, this calls the math log lol
|
||||
return;
|
||||
}
|
||||
|
||||
region->mFreeBytes += entryToDelete->size;
|
||||
|
||||
//Remove the entry from the linked list
|
||||
if(entryToDelete->prev != nullptr){
|
||||
entryToDelete->prev->next = entryToDelete->next;
|
||||
}
|
||||
if(entryToDelete->next != nullptr) {
|
||||
entryToDelete->next->prev = entryToDelete->prev;
|
||||
}
|
||||
|
||||
if (region->unk8 == entryToDelete) {
|
||||
region->unk8 = entryToDelete->next;
|
||||
}
|
||||
|
||||
if (region->unkC == entryToDelete) {
|
||||
region->unkC = entryToDelete->prev;
|
||||
}
|
||||
|
||||
MemBlock* entry = region->func_804339B8(entryToDelete);
|
||||
entry = region->unkInline1(entry);
|
||||
|
||||
if (entry != nullptr) {
|
||||
entry = region->unkInline1(entry);
|
||||
|
||||
if (entry != NULL) {
|
||||
region->func_80433AA8(entry);
|
||||
}
|
||||
}
|
||||
|
||||
region->unk18--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 MemManager::func_804346A0(int regionIndex){
|
||||
|
Loading…
x
Reference in New Issue
Block a user