This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
275 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,7 @@ Makefile | |
Core/Inc/rom_info.h | ||
roms | ||
|
||
.mxproject | ||
.mxproject | ||
|
||
Core/Src/retro-go/nes_roms.c | ||
Core/Src/retro-go/gb_roms.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
#ifndef _GB_ROM_H_ | ||
#define _GB_ROM_H_ | ||
|
||
extern const unsigned char ROM_DATA[]; | ||
extern const unsigned ROM_DATA_LENGTH; | ||
|
||
extern unsigned char *ROM_DATA; | ||
extern unsigned ROM_DATA_LENGTH; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "rom_manager.h" | ||
#include <string.h> | ||
#include "gb_rom.h" | ||
|
||
unsigned char *ROM_DATA = NULL; | ||
unsigned ROM_DATA_LENGTH; | ||
|
||
#include "gb_roms.c" | ||
#include "nes_roms.c" | ||
|
||
const rom_system systems[] = { | ||
nes_system, | ||
gb_system | ||
}; | ||
|
||
const rom_manager rom_mgr = { | ||
.systems = systems, | ||
.systems_count = sizeof(systems) / sizeof(rom_system) | ||
}; | ||
|
||
const rom_system *rom_manager_system(const rom_manager *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]; | ||
} | ||
} | ||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
|
||
typedef struct { | ||
const char *rom_name; | ||
uint32_t flash_address; | ||
uint32_t size; | ||
} rom_entry; | ||
|
||
typedef struct { | ||
char system_name[64]; | ||
const rom_entry *roms; | ||
char *extension; | ||
uint32_t roms_count; | ||
} rom_system; | ||
|
||
typedef struct { | ||
const rom_system *systems; | ||
uint32_t systems_count; | ||
} rom_manager; | ||
|
||
extern const rom_manager rom_mgr; | ||
|
||
const rom_system *rom_manager_system(const rom_manager *mgr, char *name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.