mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge pull request #5654 from QuarkTheAwesome/wiiu-warnings
[WiiU] Various warning fixes
This commit is contained in:
commit
b8df76271c
@ -193,11 +193,11 @@ static bool ax_audio_start(void* data, bool is_shutdown)
|
||||
|
||||
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint32_t i;
|
||||
size_t countAvail = 0;
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
const uint16_t* src = buf;
|
||||
int count = size >> 2;
|
||||
size_t count = size >> 2;
|
||||
|
||||
if(!size || (size & 0x3))
|
||||
return 0;
|
||||
@ -330,8 +330,8 @@ audio_driver_t audio_ax =
|
||||
ax_audio_free,
|
||||
ax_audio_use_float,
|
||||
"AX",
|
||||
NULL,
|
||||
NULL,
|
||||
/* ax_audio_write_avail, */
|
||||
/* ax_audio_buffer_size */
|
||||
NULL, /* device_list_new */
|
||||
NULL, /* device_list_free */
|
||||
NULL, /* write_avail */
|
||||
NULL, /* buffer_size */
|
||||
};
|
||||
|
@ -308,6 +308,7 @@ frontend_ctx_driver_t frontend_ctx_wiiu =
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"wiiu",
|
||||
NULL, /* get_video_driver */
|
||||
};
|
||||
|
||||
static int wiiu_log_socket = -1;
|
||||
@ -379,6 +380,7 @@ void net_print_exp(const char *str)
|
||||
send(wiiu_log_socket, str, strlen(str), 0);
|
||||
}
|
||||
|
||||
#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT)
|
||||
static devoptab_t dotab_stdout =
|
||||
{
|
||||
"stdout_net", // device name
|
||||
@ -389,6 +391,7 @@ static devoptab_t dotab_stdout =
|
||||
NULL,
|
||||
/* ... */
|
||||
};
|
||||
#endif
|
||||
|
||||
void SaveCallback()
|
||||
{
|
||||
@ -642,7 +645,7 @@ void _start(int argc, char **argv)
|
||||
__init();
|
||||
fsdev_init();
|
||||
|
||||
int ret = main(argc, argv);
|
||||
main(argc, argv);
|
||||
|
||||
fsdev_exit();
|
||||
// __fini();
|
||||
|
@ -51,7 +51,7 @@ static const wiiu_render_mode_t wiiu_render_mode_map[] =
|
||||
{1920, 1080, GX2_TV_RENDER_MODE_WIDE_1080P} /* GX2_TV_SCAN_MODE_1080P */
|
||||
};
|
||||
|
||||
static int wiiu_set_position(position_t* position, GX2ColorBuffer* draw_buffer, float x0, float y0, float x1, float y1)
|
||||
static void wiiu_set_position(position_t* position, GX2ColorBuffer* draw_buffer, float x0, float y0, float x1, float y1)
|
||||
{
|
||||
position[0].x = (2.0f * x0 / draw_buffer->surface.width) - 1.0f;
|
||||
position[0].y = (2.0f * y0 / draw_buffer->surface.height) - 1.0f;
|
||||
@ -194,7 +194,6 @@ static void wiiu_gfx_set_aspect_ratio(void* data, unsigned aspect_ratio_idx)
|
||||
static void* wiiu_gfx_init(const video_info_t* video,
|
||||
const input_driver_t** input, void** input_data)
|
||||
{
|
||||
int i;
|
||||
float refresh_rate = 60.0f / 1.001f;
|
||||
u32 size = 0;
|
||||
u32 tmp = 0;
|
||||
@ -387,9 +386,9 @@ static void* wiiu_gfx_init(const video_info_t* video,
|
||||
|
||||
wiiu->vertex_cache.size = 0x1000;
|
||||
wiiu->vertex_cache.current = 0;
|
||||
wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size
|
||||
wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size
|
||||
* sizeof(position_t), GX2_VERTEX_BUFFER_ALIGNMENT);
|
||||
wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size
|
||||
wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size
|
||||
* sizeof(tex_coord_t), GX2_VERTEX_BUFFER_ALIGNMENT);
|
||||
|
||||
/* Initialize samplers */
|
||||
@ -498,7 +497,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
static u32 lastTick , currentTick;
|
||||
u32 diff;
|
||||
#endif
|
||||
int i;
|
||||
uint32_t i;
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
|
||||
(void)msg;
|
||||
@ -572,7 +571,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
int j;
|
||||
uint32_t j;
|
||||
for(j = 0; j < width; j++)
|
||||
dst[j] = src[j];
|
||||
dst += wiiu->texture.surface.pitch;
|
||||
@ -725,7 +724,7 @@ static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle)
|
||||
static uintptr_t wiiu_gfx_load_texture(void* video_data, void* data,
|
||||
bool threaded, enum texture_filter_type filter_type)
|
||||
{
|
||||
int i;
|
||||
uint32_t i;
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) video_data;
|
||||
struct texture_image *image = (struct texture_image*)data;
|
||||
|
||||
@ -785,7 +784,7 @@ static void wiiu_gfx_apply_state_changes(void* data)
|
||||
static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
{
|
||||
int i;
|
||||
uint32_t i;
|
||||
const uint16_t *src = NULL;
|
||||
uint16_t *dst = NULL;
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
@ -851,13 +850,13 @@ static const video_poke_interface_t wiiu_poke_interface =
|
||||
{
|
||||
wiiu_gfx_load_texture,
|
||||
wiiu_gfx_unload_texture,
|
||||
NULL,
|
||||
NULL, /* set_video_mode */
|
||||
wiiu_gfx_set_filtering,
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
NULL, /* get_video_output_next */
|
||||
NULL, /* get_current_framebuffer */
|
||||
NULL,
|
||||
NULL, /* get_proc_address */
|
||||
wiiu_gfx_set_aspect_ratio,
|
||||
wiiu_gfx_apply_state_changes,
|
||||
#ifdef HAVE_MENU
|
||||
@ -865,9 +864,11 @@ static const video_poke_interface_t wiiu_poke_interface =
|
||||
#endif
|
||||
wiiu_gfx_set_texture_enable,
|
||||
wiiu_gfx_set_osd_msg,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
NULL, /* show_mouse */
|
||||
NULL, /* grab_mouse_toggle */
|
||||
NULL, /* get_current_shader */
|
||||
NULL, /* get_current_software_framebuffer */
|
||||
NULL, /* get_hw_render_interface */
|
||||
};
|
||||
|
||||
static void wiiu_gfx_get_poke_interface(void* data,
|
||||
@ -898,4 +899,5 @@ video_driver_t video_wiiu =
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
wiiu_gfx_get_poke_interface,
|
||||
NULL, /* wrap_type_to_enum */
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ typedef struct
|
||||
static void* wiiu_font_init_font(void* data, const char* font_path,
|
||||
float font_size, bool is_threaded)
|
||||
{
|
||||
int i;
|
||||
uint32_t i;
|
||||
wiiu_font_t* font = (wiiu_font_t*)calloc(1, sizeof(*font));
|
||||
|
||||
if (!font)
|
||||
|
@ -63,17 +63,16 @@ static char hidName[HID_COUNT][255];
|
||||
|
||||
static const char* wiiu_joypad_name(unsigned pad)
|
||||
{
|
||||
if (pad == 0)
|
||||
if (pad > MAX_PADS) return "N/A";
|
||||
|
||||
if (pad == GAMEPAD_OFFSET)
|
||||
return "WIIU Gamepad";
|
||||
|
||||
if (pad < MAX_PADS && pad < (HID_OFFSET) && pad > GAMEPAD_OFFSET)
|
||||
if (pad >= KPAD_OFFSET && pad < KPAD_OFFSET + KPAD_COUNT)
|
||||
{
|
||||
int i = pad - KPAD_OFFSET;
|
||||
switch (pad_type[i])
|
||||
{
|
||||
case WIIUINPUT_TYPE_NONE:
|
||||
return "N/A";
|
||||
|
||||
case WIIUINPUT_TYPE_PRO_CONTROLLER:
|
||||
return "WIIU Pro Controller";
|
||||
|
||||
@ -85,13 +84,17 @@ static const char* wiiu_joypad_name(unsigned pad)
|
||||
|
||||
case WIIUINPUT_TYPE_CLASSIC_CONTROLLER:
|
||||
return "Classic Controller";
|
||||
|
||||
case WIIUINPUT_TYPE_NONE:
|
||||
default:
|
||||
return "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
if (pad < MAX_PADS)
|
||||
if (pad >= HID_OFFSET && pad < HID_OFFSET + HID_COUNT)
|
||||
{
|
||||
s32 hid_index = pad-HID_OFFSET;
|
||||
sprintf(hidName[hid_index],"HID %04X/%04X(%02X)",hid_data[hid_index].device_info.vidpid.vid,hid_data[hid_index].device_info.vidpid.pid,hid_data[hid_index].pad);
|
||||
s32 hid_index = pad - HID_OFFSET;
|
||||
sprintf(hidName[hid_index], "HID %04X/%04X(%02X)", hid_data[hid_index].device_info.vidpid.vid, hid_data[hid_index].device_info.vidpid.pid, hid_data[hid_index].pad);
|
||||
return hidName[hid_index];
|
||||
}
|
||||
|
||||
|
@ -31,174 +31,174 @@
|
||||
|
||||
int MountFS(void *pClient, void *pCmd, char **mount_path)
|
||||
{
|
||||
int result = -1;
|
||||
int result = -1;
|
||||
|
||||
void *mountSrc = malloc(FS_MOUNT_SOURCE_SIZE);
|
||||
if(!mountSrc)
|
||||
return -3;
|
||||
void *mountSrc = malloc(FS_MOUNT_SOURCE_SIZE);
|
||||
if(!mountSrc)
|
||||
return -3;
|
||||
|
||||
char* mountPath = (char*) malloc(FS_MAX_MOUNTPATH_SIZE);
|
||||
if(!mountPath) {
|
||||
free(mountSrc);
|
||||
return -4;
|
||||
}
|
||||
char* mountPath = (char*) malloc(FS_MAX_MOUNTPATH_SIZE);
|
||||
if(!mountPath) {
|
||||
free(mountSrc);
|
||||
return -4;
|
||||
}
|
||||
|
||||
memset(mountSrc, 0, FS_MOUNT_SOURCE_SIZE);
|
||||
memset(mountPath, 0, FS_MAX_MOUNTPATH_SIZE);
|
||||
memset(mountSrc, 0, FS_MOUNT_SOURCE_SIZE);
|
||||
memset(mountPath, 0, FS_MAX_MOUNTPATH_SIZE);
|
||||
|
||||
// Mount sdcard
|
||||
if (FSGetMountSource(pClient, pCmd, FS_SOURCETYPE_EXTERNAL, mountSrc, -1) == 0)
|
||||
{
|
||||
result = FSMount(pClient, pCmd, mountSrc, mountPath, FS_MAX_MOUNTPATH_SIZE, -1);
|
||||
if((result == 0) && mount_path) {
|
||||
*mount_path = (char*)malloc(strlen(mountPath) + 1);
|
||||
if(*mount_path)
|
||||
strcpy(*mount_path, mountPath);
|
||||
}
|
||||
}
|
||||
// Mount sdcard
|
||||
if (FSGetMountSource(pClient, pCmd, FS_SOURCETYPE_EXTERNAL, mountSrc, -1) == 0)
|
||||
{
|
||||
result = FSMount(pClient, pCmd, mountSrc, mountPath, FS_MAX_MOUNTPATH_SIZE, -1);
|
||||
if((result == 0) && mount_path) {
|
||||
*mount_path = (char*)malloc(strlen(mountPath) + 1);
|
||||
if(*mount_path)
|
||||
strcpy(*mount_path, mountPath);
|
||||
}
|
||||
}
|
||||
|
||||
free(mountPath);
|
||||
free(mountSrc);
|
||||
return result;
|
||||
free(mountPath);
|
||||
free(mountSrc);
|
||||
return result;
|
||||
}
|
||||
|
||||
int UmountFS(void *pClient, void *pCmd, const char *mountPath)
|
||||
{
|
||||
int result = -1;
|
||||
result = FSUnmount(pClient, pCmd, mountPath, -1);
|
||||
int result = -1;
|
||||
result = FSUnmount(pClient, pCmd, mountPath, -1);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size)
|
||||
{
|
||||
//! always initialze input
|
||||
*inbuffer = NULL;
|
||||
if(size)
|
||||
*size = 0;
|
||||
//! always initialze input
|
||||
*inbuffer = NULL;
|
||||
if(size)
|
||||
*size = 0;
|
||||
|
||||
int iFd = open(filepath, O_RDONLY);
|
||||
if (iFd < 0)
|
||||
return -1;
|
||||
int iFd = open(filepath, O_RDONLY);
|
||||
if (iFd < 0)
|
||||
return -1;
|
||||
|
||||
u32 filesize = lseek(iFd, 0, SEEK_END);
|
||||
lseek(iFd, 0, SEEK_SET);
|
||||
u32 filesize = lseek(iFd, 0, SEEK_END);
|
||||
lseek(iFd, 0, SEEK_SET);
|
||||
|
||||
u8 *buffer = (u8 *) malloc(filesize);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
close(iFd);
|
||||
return -2;
|
||||
}
|
||||
u8 *buffer = (u8 *) malloc(filesize);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
close(iFd);
|
||||
return -2;
|
||||
}
|
||||
|
||||
u32 blocksize = 0x4000;
|
||||
u32 done = 0;
|
||||
int readBytes = 0;
|
||||
u32 blocksize = 0x4000;
|
||||
u32 done = 0;
|
||||
int readBytes = 0;
|
||||
|
||||
while(done < filesize)
|
||||
{
|
||||
if(done + blocksize > filesize) {
|
||||
blocksize = filesize - done;
|
||||
}
|
||||
readBytes = read(iFd, buffer + done, blocksize);
|
||||
if(readBytes <= 0)
|
||||
break;
|
||||
done += readBytes;
|
||||
}
|
||||
while(done < filesize)
|
||||
{
|
||||
if(done + blocksize > filesize) {
|
||||
blocksize = filesize - done;
|
||||
}
|
||||
readBytes = read(iFd, buffer + done, blocksize);
|
||||
if(readBytes <= 0)
|
||||
break;
|
||||
done += readBytes;
|
||||
}
|
||||
|
||||
close(iFd);
|
||||
close(iFd);
|
||||
|
||||
if (done != filesize)
|
||||
{
|
||||
free(buffer);
|
||||
return -3;
|
||||
}
|
||||
if (done != filesize)
|
||||
{
|
||||
free(buffer);
|
||||
return -3;
|
||||
}
|
||||
|
||||
*inbuffer = buffer;
|
||||
*inbuffer = buffer;
|
||||
|
||||
//! sign is optional input
|
||||
if(size)
|
||||
*size = filesize;
|
||||
//! sign is optional input
|
||||
if(size)
|
||||
*size = filesize;
|
||||
|
||||
return filesize;
|
||||
return filesize;
|
||||
}
|
||||
|
||||
int CheckFile(const char * filepath)
|
||||
{
|
||||
if(!filepath)
|
||||
return 0;
|
||||
if(!filepath)
|
||||
return 0;
|
||||
|
||||
struct stat filestat;
|
||||
struct stat filestat;
|
||||
|
||||
char dirnoslash[strlen(filepath)+2];
|
||||
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
|
||||
char dirnoslash[strlen(filepath)+2];
|
||||
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
|
||||
|
||||
while(dirnoslash[strlen(dirnoslash)-1] == '/')
|
||||
dirnoslash[strlen(dirnoslash)-1] = '\0';
|
||||
while(dirnoslash[strlen(dirnoslash)-1] == '/')
|
||||
dirnoslash[strlen(dirnoslash)-1] = '\0';
|
||||
|
||||
char * notRoot = strrchr(dirnoslash, '/');
|
||||
if(!notRoot)
|
||||
{
|
||||
strcat(dirnoslash, "/");
|
||||
}
|
||||
char * notRoot = strrchr(dirnoslash, '/');
|
||||
if(!notRoot)
|
||||
{
|
||||
strcat(dirnoslash, "/");
|
||||
}
|
||||
|
||||
if (stat(dirnoslash, &filestat) == 0)
|
||||
return 1;
|
||||
if (stat(dirnoslash, &filestat) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CreateSubfolder(const char * fullpath)
|
||||
{
|
||||
if(!fullpath)
|
||||
return 0;
|
||||
if(!fullpath)
|
||||
return 0;
|
||||
|
||||
int result = 0;
|
||||
int result = 0;
|
||||
|
||||
char dirnoslash[strlen(fullpath)+1];
|
||||
strcpy(dirnoslash, fullpath);
|
||||
char dirnoslash[strlen(fullpath)+1];
|
||||
strcpy(dirnoslash, fullpath);
|
||||
|
||||
int pos = strlen(dirnoslash)-1;
|
||||
while(dirnoslash[pos] == '/')
|
||||
{
|
||||
dirnoslash[pos] = '\0';
|
||||
pos--;
|
||||
}
|
||||
int pos = strlen(dirnoslash)-1;
|
||||
while(dirnoslash[pos] == '/')
|
||||
{
|
||||
dirnoslash[pos] = '\0';
|
||||
pos--;
|
||||
}
|
||||
|
||||
if(CheckFile(dirnoslash))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char parentpath[strlen(dirnoslash)+2];
|
||||
strcpy(parentpath, dirnoslash);
|
||||
char * ptr = strrchr(parentpath, '/');
|
||||
if(CheckFile(dirnoslash))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char parentpath[strlen(dirnoslash)+2];
|
||||
strcpy(parentpath, dirnoslash);
|
||||
char * ptr = strrchr(parentpath, '/');
|
||||
|
||||
if(!ptr)
|
||||
{
|
||||
//!Device root directory (must be with '/')
|
||||
strcat(parentpath, "/");
|
||||
struct stat filestat;
|
||||
if (stat(parentpath, &filestat) == 0)
|
||||
return 1;
|
||||
if(!ptr)
|
||||
{
|
||||
//!Device root directory (must be with '/')
|
||||
strcat(parentpath, "/");
|
||||
struct stat filestat;
|
||||
if (stat(parentpath, &filestat) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr++;
|
||||
ptr[0] = '\0';
|
||||
ptr++;
|
||||
ptr[0] = '\0';
|
||||
|
||||
result = CreateSubfolder(parentpath);
|
||||
}
|
||||
result = CreateSubfolder(parentpath);
|
||||
}
|
||||
|
||||
if(!result)
|
||||
return 0;
|
||||
if(!result)
|
||||
return 0;
|
||||
|
||||
if (mkdir(dirnoslash, 0777) == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (mkdir(dirnoslash, 0777) == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <wiiu/os.h>
|
||||
|
||||
#include "hbl.h"
|
||||
@ -236,7 +237,7 @@ int HBL_loadToMemory(const char *filepath, u32 args_size)
|
||||
if (bytesRead != fileSize)
|
||||
{
|
||||
free(buffer);
|
||||
printf("File loading not finished for file %s, finished %i of %i bytes\n", filepath, bytesRead,
|
||||
printf("File loading not finished for file %s, finished %" PRIi32 " of %" PRIi32 " bytes\n", filepath, bytesRead,
|
||||
fileSize);
|
||||
printf("File read failure");
|
||||
return -1;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <wiiu/os.h>
|
||||
#include "wiiu_dbg.h"
|
||||
#include "exception_handler.h"
|
||||
@ -34,7 +35,7 @@ extern unsigned int __code_end;
|
||||
#define TEXT_END (unsigned int)&__code_end
|
||||
|
||||
void test_os_exceptions(void);
|
||||
void exception_print_symbol(unsigned int addr);
|
||||
void exception_print_symbol(uint32_t addr);
|
||||
|
||||
typedef struct _framerec
|
||||
{
|
||||
@ -91,7 +92,7 @@ void __attribute__((__noreturn__)) exception_cb(OSContext* ctx, OSExceptionType
|
||||
if (type == OS_EXCEPTION_TYPE_DSI) {
|
||||
/* Exception type and offending instruction location
|
||||
Also initializes exception_msgbuf, use buf_add from now on */
|
||||
buf_add("DSI: Instr at %08X", ctx->srr0);
|
||||
buf_add("DSI: Instr at %08" PRIX32, ctx->srr0);
|
||||
/* Was this a read or a write? */
|
||||
if (ctx->dsisr & DSISR_WRITE_ATTEMPTED) {
|
||||
buf_add(" bad write to");
|
||||
@ -107,7 +108,7 @@ void __attribute__((__noreturn__)) exception_cb(OSContext* ctx, OSExceptionType
|
||||
} else if (ctx->dsisr & DSISR_BAD_CACHING) {
|
||||
buf_add(" uncached memory at");
|
||||
}
|
||||
buf_add(" %08X\n", ctx->dar);
|
||||
buf_add(" %08" PRIX32 "\n", ctx->dar);
|
||||
} else if (type == OS_EXCEPTION_TYPE_ISI) {
|
||||
buf_add("ISI: Bad execute of");
|
||||
if (ctx->srr1 & SRR1_ISI_TRANSLATION_PROT) {
|
||||
@ -115,7 +116,7 @@ void __attribute__((__noreturn__)) exception_cb(OSContext* ctx, OSExceptionType
|
||||
} else if (ctx->srr1 & SRR1_ISI_TRANSLATION_MISS) {
|
||||
buf_add(" unmapped memory at");
|
||||
}
|
||||
buf_add(" %08X\n", ctx->srr0);
|
||||
buf_add(" %08" PRIX32 "\n", ctx->srr0);
|
||||
} else if (type == OS_EXCEPTION_TYPE_PROGRAM) {
|
||||
buf_add("PROG:");
|
||||
if (ctx->srr1 & SRR1_PROG_BAD_INSTR) {
|
||||
@ -130,9 +131,9 @@ void __attribute__((__noreturn__)) exception_cb(OSContext* ctx, OSExceptionType
|
||||
buf_add(" Out-of-spec error (!) at");
|
||||
}
|
||||
if (ctx->srr1 & SRR1_PROG_SRR0_INACCURATE) {
|
||||
buf_add("%08X-ish\n", ctx->srr0);
|
||||
buf_add("%08" PRIX32 "-ish\n", ctx->srr0);
|
||||
} else {
|
||||
buf_add("%08X\n", ctx->srr0);
|
||||
buf_add("%08" PRIX32 "\n", ctx->srr0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,14 +141,14 @@ void __attribute__((__noreturn__)) exception_cb(OSContext* ctx, OSExceptionType
|
||||
There's space for two more regs at the end of the last line...
|
||||
Any ideas for what to put there? */
|
||||
buf_add( \
|
||||
"r0 %08X r1 %08X r2 %08X r3 %08X r4 %08X\n" \
|
||||
"r5 %08X r6 %08X r7 %08X r8 %08X r9 %08X\n" \
|
||||
"r10 %08X r11 %08X r12 %08X r13 %08X r14 %08X\n" \
|
||||
"r15 %08X r16 %08X r17 %08X r18 %08X r19 %08X\n" \
|
||||
"r20 %08X r21 %08X r22 %08X r23 %08X r24 %08X\n" \
|
||||
"r25 %08X r26 %08X r27 %08X r28 %08X r29 %08X\n" \
|
||||
"r30 %08X r31 %08X lr %08X sr1 %08X dsi %08X\n" \
|
||||
"ctr %08X cr %08X xer %08X\n",\
|
||||
"r0 %08" PRIX32 " r1 %08" PRIX32 " r2 %08" PRIX32 " r3 %08" PRIX32 " r4 %08" PRIX32 "\n" \
|
||||
"r5 %08" PRIX32 " r6 %08" PRIX32 " r7 %08" PRIX32 " r8 %08" PRIX32 " r9 %08" PRIX32 "\n" \
|
||||
"r10 %08" PRIX32 " r11 %08" PRIX32 " r12 %08" PRIX32 " r13 %08" PRIX32 " r14 %08" PRIX32 "\n" \
|
||||
"r15 %08" PRIX32 " r16 %08" PRIX32 " r17 %08" PRIX32 " r18 %08" PRIX32 " r19 %08" PRIX32 "\n" \
|
||||
"r20 %08" PRIX32 " r21 %08" PRIX32 " r22 %08" PRIX32 " r23 %08" PRIX32 " r24 %08" PRIX32 "\n" \
|
||||
"r25 %08" PRIX32 " r26 %08" PRIX32 " r27 %08" PRIX32 " r28 %08" PRIX32 " r29 %08" PRIX32 "\n" \
|
||||
"r30 %08" PRIX32 " r31 %08" PRIX32 " lr %08" PRIX32 " sr1 %08" PRIX32 " dsi %08" PRIX32 "\n" \
|
||||
"ctr %08" PRIX32 " cr %08" PRIX32 " xer %08" PRIX32 "\n",\
|
||||
ctx->gpr[0], ctx->gpr[1], ctx->gpr[2], ctx->gpr[3], ctx->gpr[4], \
|
||||
ctx->gpr[5], ctx->gpr[6], ctx->gpr[7], ctx->gpr[8], ctx->gpr[9], \
|
||||
ctx->gpr[10], ctx->gpr[11], ctx->gpr[12], ctx->gpr[13], ctx->gpr[14], \
|
||||
@ -190,13 +191,13 @@ BOOL __attribute__((__noreturn__)) exception_prog_cb(OSContext* ctx) {
|
||||
exception_cb(ctx, OS_EXCEPTION_TYPE_PROGRAM);
|
||||
}
|
||||
|
||||
void exception_print_symbol(unsigned int addr) {
|
||||
void exception_print_symbol(uint32_t addr) {
|
||||
/* Check if addr is within this RPX's .text */
|
||||
if (addr >= TEXT_START && addr < TEXT_END) {
|
||||
char symbolName[64];
|
||||
OSGetSymbolName(addr, symbolName, 63);
|
||||
|
||||
buf_add("%08X(%08X):%s\n", addr, addr - TEXT_START, symbolName);
|
||||
buf_add("%08" PRIX32 "(%08" PRIX32 "):%s\n", addr, addr - TEXT_START, symbolName);
|
||||
}
|
||||
/* Check if addr is within the system library area... */
|
||||
else if ((addr >= 0x01000000 && addr < 0x01800000) ||
|
||||
@ -218,23 +219,23 @@ void exception_print_symbol(unsigned int addr) {
|
||||
*seperator = '|';
|
||||
/* We got one! */
|
||||
if (libAddr) {
|
||||
buf_add("%08X(%08X):%s\n", addr, addr - (unsigned int)libAddr, symbolName);
|
||||
buf_add("%08" PRIX32 "(%08" PRIX32 "):%s\n", addr, addr - (unsigned int)libAddr, symbolName);
|
||||
OSDynLoad_Release(libAddr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* Ah well. We can still print the basics. */
|
||||
buf_add("%08X( ):%s\n", addr, symbolName);
|
||||
buf_add("%08" PRIX32 "( ):%s\n", addr, symbolName);
|
||||
}
|
||||
/* Check if addr is in the HBL range
|
||||
TODO there's no real reason we couldn't find the symbol here,
|
||||
it's just laziness and arguably uneccesary bloat */
|
||||
else if (addr >= 0x00800000 && addr < 0x01000000) {
|
||||
buf_add("%08X(%08X):<unknown:HBL>\n", addr, addr - 0x00800000);
|
||||
buf_add("%08" PRIX32 "(%08" PRIX32 "):<unknown:HBL>\n", addr, addr - 0x00800000);
|
||||
}
|
||||
/* If all else fails, just say "unknown" */
|
||||
else {
|
||||
buf_add("%08X( ):<unknown>\n", addr);
|
||||
buf_add("%08" PRIX32 "( ):<unknown>\n", addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef WIIU
|
||||
#include <wiiu/types.h>
|
||||
@ -26,11 +27,11 @@ void DisassemblePPCRange(void *start, void *end, void* printf_func, void* GetSym
|
||||
//#define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
|
||||
#define DEBUG_LINE() do{printf("%s:%4d %s().\n", __FILE__, __LINE__, __FUNCTION__);fflush(stdout);}while(0)
|
||||
#define DEBUG_STR(X) printf( "%s: %s\n", #X, (char*)(X))
|
||||
#define DEBUG_VAR(X) printf( "%-20s: 0x%08X\n", #X, (uint32_t)(X))
|
||||
#define DEBUG_VAR2(X) printf( "%-20s: 0x%08X (%i)\n", #X, (uint32_t)(X), (int)(X))
|
||||
#define DEBUG_INT(X) printf( "%-20s: %10i\n", #X, (int32_t)(X))
|
||||
#define DEBUG_VAR(X) printf( "%-20s: 0x%08" PRIX32 "\n", #X, (uint32_t)(X))
|
||||
#define DEBUG_VAR2(X) printf( "%-20s: 0x%08" PRIX32 " (%i)\n", #X, (uint32_t)(X), (int)(X))
|
||||
#define DEBUG_INT(X) printf( "%-20s: %10" PRIi32 "\n", #X, (int32_t)(X))
|
||||
#define DEBUG_FLOAT(X) printf( "%-20s: %10.3f\n", #X, (float)(X))
|
||||
#define DEBUG_VAR64(X) printf( #X"\r\t\t\t\t : 0x%016llX\n", (uint64_t)(X))
|
||||
#define DEBUG_VAR64(X) printf( #X"\r\t\t\t\t : 0x%016" PRIX64 "\n", (uint64_t)(X))
|
||||
//#define DEBUG_ERROR(X) do{if(X)dump_result_value(X);}while(0)
|
||||
#define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H"
|
||||
#define PRINTFPOS_STR(X,Y) "\x1b[" X ";" Y "H"
|
||||
|
Loading…
x
Reference in New Issue
Block a user