From 72ebd229e26ca2b1fcbf3febd1901f551beeb1a0 Mon Sep 17 00:00:00 2001 From: Konrad Beckmann Date: Sat, 19 Dec 2020 16:11:56 +0100 Subject: [PATCH] Add _t suffix and get rid of some warnings --- Core/Src/retro-go/rg_emulators.c | 4 ++-- Core/Src/retro-go/rg_emulators.h | 2 +- Core/Src/retro-go/rom_manager.c | 7 ++++--- Core/Src/retro-go/rom_manager.h | 14 +++++++------- parse_roms.py | 4 ++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Core/Src/retro-go/rg_emulators.c b/Core/Src/retro-go/rg_emulators.c index 928a8b06..3e3233a2 100644 --- a/Core/Src/retro-go/rg_emulators.c +++ b/Core/Src/retro-go/rg_emulators.c @@ -102,11 +102,11 @@ void emulator_init(retro_emulator_t *emu) printf("Retro-Go: Initializing emulator '%s'\n", emu->system_name); - const rom_system *system = rom_manager_system(&rom_mgr, emu->system_name); + const rom_system_t *system = rom_manager_system(&rom_mgr, emu->system_name); if(system) { emu->roms.files = rg_alloc(system->roms_count * sizeof(retro_emulator_file_t), MEM_ANY); for(int i=0; i < system->roms_count; i++) { - const rom_entry *rom = &system->roms[i]; + const rom_entry_t *rom = &system->roms[i]; retro_emulator_file_t *file = &emu->roms.files[emu->roms.count++]; // strcpy(file->folder, "/"); file->emulator = (void*)emu; diff --git a/Core/Src/retro-go/rg_emulators.h b/Core/Src/retro-go/rg_emulators.h index 2852b9ac..f6094176 100644 --- a/Core/Src/retro-go/rg_emulators.h +++ b/Core/Src/retro-go/rg_emulators.h @@ -8,7 +8,7 @@ typedef struct { char name[128]; char ext[8]; // char folder[32]; - uint32_t address; + uint8_t *address; size_t size; size_t crc_offset; uint32_t checksum; diff --git a/Core/Src/retro-go/rom_manager.c b/Core/Src/retro-go/rom_manager.c index 7bbaadbf..d7a8e82a 100644 --- a/Core/Src/retro-go/rom_manager.c +++ b/Core/Src/retro-go/rom_manager.c @@ -1,4 +1,5 @@ #include +#include #include "rom_manager.h" #include "rg_emulators.h" @@ -10,17 +11,17 @@ retro_emulator_file_t *ACTIVE_FILE = NULL; #include "gb_roms.c" #include "nes_roms.c" -const rom_system systems[] = { +const rom_system_t systems[] = { nes_system, gb_system }; -const rom_manager rom_mgr = { +const rom_manager_t rom_mgr = { .systems = systems, .systems_count = 2 }; -const rom_system *rom_manager_system(const rom_manager *mgr, char *name) { +const rom_system_t *rom_manager_system(const rom_manager_t *mgr, char *name) { for(int i=0; i < mgr->systems_count; i++) { if(strcmp(mgr->systems[i].system_name, name) == 0) { return &mgr->systems[i]; diff --git a/Core/Src/retro-go/rom_manager.h b/Core/Src/retro-go/rom_manager.h index 23233e8f..49fc492a 100644 --- a/Core/Src/retro-go/rom_manager.h +++ b/Core/Src/retro-go/rom_manager.h @@ -8,24 +8,24 @@ typedef struct { const char *rom_name; uint32_t flash_address; uint32_t size; -} rom_entry; +} rom_entry_t; typedef struct { char system_name[64]; - const rom_entry *roms; + const rom_entry_t *roms; char *extension; uint32_t roms_count; -} rom_system; +} rom_system_t; typedef struct { - const rom_system *systems; + const rom_system_t *systems; uint32_t systems_count; -} rom_manager; +} rom_manager_t; -extern const rom_manager rom_mgr; +extern const rom_manager_t rom_mgr; extern unsigned char *ROM_DATA; extern unsigned ROM_DATA_LENGTH; extern retro_emulator_file_t *ACTIVE_FILE; -const rom_system *rom_manager_system(const rom_manager *mgr, char *name); +const rom_system_t *rom_manager_system(const rom_manager_t *mgr, char *name); void rom_manager_set_active_file(retro_emulator_file_t *file); diff --git a/parse_roms.py b/parse_roms.py index b7d40d9b..8f2f733c 100755 --- a/parse_roms.py +++ b/parse_roms.py @@ -3,7 +3,7 @@ import os ROM_ENTRIES_TEMPLATE = """ -const rom_entry {name}[] = {{ +const rom_entry_t {name}[] = {{ {body} }}; const uint32_t {name}_count = {rom_count}; @@ -12,7 +12,7 @@ ROM_ENTRY_TEMPLATE = """\t{{.rom_name = "{name}", .flash_address = (uint32_t)&{variable_name}[0], .size={size}}},""" SYSTEM_TEMPLATE = """ -const rom_system {name} = {{ +const rom_system_t {name} = {{ .system_name = "{system_name}", .roms = {variable_name}, .extension = "{extension}",