mirror of
https://github.com/modmii/YAWM-ModMii-Edition.git
synced 2024-11-28 10:54:14 +01:00
viewData wasn't being freed
This commit is contained in:
parent
289a1cee79
commit
53072c83fe
@ -4,51 +4,28 @@
|
|||||||
#include "fileops.h"
|
#include "fileops.h"
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
|
|
||||||
|
static struct stat st;
|
||||||
|
|
||||||
bool FSOPFileExists(const char* file)
|
bool FSOPFileExists(const char* file)
|
||||||
{
|
{
|
||||||
FILE* f;
|
return !stat(file, &st) && !S_ISDIR(st.st_mode);
|
||||||
f = fopen(file, "rb");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FSOPFolderExists(const char* path)
|
bool FSOPFolderExists(const char* path)
|
||||||
{
|
{
|
||||||
DIR* dir;
|
return !stat(path, &st) && S_ISDIR(st.st_mode);
|
||||||
dir = opendir(path);
|
|
||||||
if (dir)
|
|
||||||
{
|
|
||||||
closedir(dir);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FSOPGetFileSizeBytes(const char* path)
|
size_t FSOPGetFileSizeBytes(const char* path)
|
||||||
{
|
{
|
||||||
FILE* f;
|
if (stat(path, &st) < 0) return 0;
|
||||||
size_t size = 0;
|
|
||||||
|
|
||||||
f = fopen(path, "rb");
|
return st.st_size;
|
||||||
if (!f)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fseek(f, 0, SEEK_END);
|
|
||||||
size = ftell(f);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSOPDeleteFile(const char* file)
|
void FSOPDeleteFile(const char* file)
|
||||||
{
|
{
|
||||||
if (!FSOPFileExists(file))
|
if (FSOPFileExists(file))
|
||||||
return;
|
|
||||||
|
|
||||||
remove(file);
|
remove(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,8 +66,11 @@ s32 FSOPReadOpenFileA(FILE* fp, void** buffer, u32 offset, u32 length)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s32 ret = FSOPReadOpenFile(fp, *buffer, offset, length);
|
s32 ret = FSOPReadOpenFile(fp, *buffer, offset, length);
|
||||||
if (ret < 0)
|
if (ret <= 0)
|
||||||
|
{
|
||||||
free(*buffer);
|
free(*buffer);
|
||||||
|
*buffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __FILEOPS_H__
|
#ifndef __FILEOPS_H__
|
||||||
#define __FILEOPS_H__
|
#define __FILEOPS_H__
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
|
|
||||||
|
@ -158,6 +158,11 @@ void Sys_Shutdown(void)
|
|||||||
|
|
||||||
void Sys_LoadMenu(void)
|
void Sys_LoadMenu(void)
|
||||||
{
|
{
|
||||||
|
/* SYSCALL(exit) does all of this already */
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
/* Also the code gcc generated for this looks really painful */
|
||||||
|
#if 0
|
||||||
int HBC = 0;
|
int HBC = 0;
|
||||||
char *sig = (char *)0x80001804;
|
char *sig = (char *)0x80001804;
|
||||||
if (sig[0] == 'S' &&
|
if (sig[0] == 'S' &&
|
||||||
@ -179,6 +184,7 @@ void Sys_LoadMenu(void)
|
|||||||
}
|
}
|
||||||
/* Return to the Wii system menu */
|
/* Return to the Wii system menu */
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
|
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
|
||||||
|
15
source/wad.c
15
source/wad.c
@ -1165,6 +1165,13 @@ s32 Wad_Uninstall(FILE *fp)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!__Wad_VerifyHeader(header))
|
||||||
|
{
|
||||||
|
puts("Invalid WAD file?");
|
||||||
|
ret = ES_EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get title ID */
|
/* Get title ID */
|
||||||
ret = __Wad_GetTitleID(fp, header, &tid);
|
ret = __Wad_GetTitleID(fp, header, &tid);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1215,7 +1222,8 @@ s32 Wad_Uninstall(FILE *fp)
|
|||||||
GetSysMenuRegion(NULL, ®ion);
|
GetSysMenuRegion(NULL, ®ion);
|
||||||
|
|
||||||
if((tid == TITLE_ID(0x10008, 0x48414B00 | 'E') || tid == TITLE_ID(0x10008, 0x48414B00 | 'P') || tid == TITLE_ID(0x10008, 0x48414B00 | 'J') || tid == TITLE_ID(0x10008, 0x48414B00 | 'K')
|
if((tid == TITLE_ID(0x10008, 0x48414B00 | 'E') || tid == TITLE_ID(0x10008, 0x48414B00 | 'P') || tid == TITLE_ID(0x10008, 0x48414B00 | 'J') || tid == TITLE_ID(0x10008, 0x48414B00 | 'K')
|
||||||
|| (tid == TITLE_ID(0x10008, 0x48414C00 | 'E') || tid == TITLE_ID(0x10008, 0x48414C00 | 'P') || tid == TITLE_ID(0x10008, 0x48414C00 | 'J') || tid == TITLE_ID(0x10008, 0x48414C00 | 'K'))) && region == 0)
|
|| (tid == TITLE_ID(0x10008, 0x48414C00 | 'E') || tid == TITLE_ID(0x10008, 0x48414C00 | 'P') || tid == TITLE_ID(0x10008, 0x48414C00 | 'J') || tid == TITLE_ID(0x10008, 0x48414C00 | 'K')))
|
||||||
|
&& region == 0)
|
||||||
{
|
{
|
||||||
printf("\n Unknown SM region\n Please check the site for updates\n");
|
printf("\n Unknown SM region\n Please check the site for updates\n");
|
||||||
ret = -999;
|
ret = -999;
|
||||||
@ -1257,9 +1265,9 @@ s32 Wad_Uninstall(FILE *fp)
|
|||||||
printf(" ERROR! (ret = %d)\n", ret);
|
printf(" ERROR! (ret = %d)\n", ret);
|
||||||
|
|
||||||
/* Delete tickets */
|
/* Delete tickets */
|
||||||
if (ret >= 0) {
|
else {
|
||||||
u32 cnt;
|
u32 cnt;
|
||||||
tikview view ATTRIBUTE_ALIGN(0x20) = {};
|
static tikview view ATTRIBUTE_ALIGN(0x20);
|
||||||
|
|
||||||
/* Delete all tickets */
|
/* Delete all tickets */
|
||||||
for (cnt = 0; cnt < viewCnt; cnt++) {
|
for (cnt = 0; cnt < viewCnt; cnt++) {
|
||||||
@ -1282,6 +1290,7 @@ s32 Wad_Uninstall(FILE *fp)
|
|||||||
else
|
else
|
||||||
printf(" OK!\n");
|
printf(" OK!\n");
|
||||||
}
|
}
|
||||||
|
free(viewData);
|
||||||
|
|
||||||
printf("\t\t>> Deleting title contents...");
|
printf("\t\t>> Deleting title contents...");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
* https://github.com/DacoTaco/priiloader/blob/master/tools/DacosLove/source/Input.cpp
|
* https://github.com/DacoTaco/priiloader/blob/master/tools/DacosLove/source/Input.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <ogc/lwp.h>
|
#include <ogc/lwp.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
@ -107,7 +109,7 @@ static void* WKBThread(__attribute__((unused)) void* arg)
|
|||||||
usleep(WKB_THREAD_UDELAY);
|
usleep(WKB_THREAD_UDELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int led = 3; led; led--) { USBKeyboard_SetLed(led, false); usleep(WKB_ANIMATION_UDELAY); }
|
// for (int led = 3; led; led--) { USBKeyboard_SetLed(led, false); usleep(WKB_ANIMATION_UDELAY); }
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +120,7 @@ void WKB_Initialize(void)
|
|||||||
|
|
||||||
WKBThreadActive = true;
|
WKBThreadActive = true;
|
||||||
LWP_CreateThread(&WKBThreadHandle, WKBThread, NULL, NULL, WKB_THREAD_STACK, WKB_THREAD_PRIORITY);
|
LWP_CreateThread(&WKBThreadHandle, WKBThread, NULL, NULL, WKB_THREAD_STACK, WKB_THREAD_PRIORITY);
|
||||||
|
atexit(WKB_Deinitialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WKB_Deinitialize(void)
|
void WKB_Deinitialize(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user