Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Add _t suffix and get rid of some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeckmann committed Dec 27, 2020
1 parent 10325ad commit 72ebd22
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Core/Src/retro-go/rg_emulators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Core/Src/retro-go/rg_emulators.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions Core/Src/retro-go/rom_manager.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <string.h>
#include <stdint.h>

#include "rom_manager.h"
#include "rg_emulators.h"
Expand All @@ -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];
Expand Down
14 changes: 7 additions & 7 deletions Core/Src/retro-go/rom_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 2 additions & 2 deletions parse_roms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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}",
Expand Down

0 comments on commit 72ebd22

Please sign in to comment.