-
-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GBA hardware extensions #2251
base: master
Are you sure you want to change the base?
GBA hardware extensions #2251
Changes from all commits
0051c82
cf6d9ef
9831a24
e563a36
7bba0eb
acc10c3
7a12e6a
36f5879
71e4e6c
58450e6
e3d7cad
6223cd7
3b0b9c3
77a0db9
cedf69f
b65493b
165e597
558a008
ece8c5a
97dac47
274183e
11a7413
d89678a
b2c2e55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
/build | ||
/build-* | ||
/.vs | ||
/.vscode | ||
|
||
*.a | ||
*.dylib | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* Copyright (c) 2013-2021 Jeffrey Pfau | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
#ifndef GBA_EXTENSIONS_H | ||
#define GBA_EXTENSIONS_H | ||
|
||
#include <mgba-util/common.h> | ||
|
||
CXX_GUARD_START | ||
|
||
#include <mgba/core/log.h> | ||
#include <mgba/core/timing.h> | ||
|
||
#include <mgba/internal/gba/io.h> | ||
|
||
#include <mgba-util/memory.h> | ||
|
||
enum GBA_EXTENSIONS_IDS { | ||
GBAEX_ID_EXTRA_RAM = 0, | ||
GBAEX_EXTENSIONS_COUNT | ||
}; | ||
|
||
#define REG_HWEX_VERSION_VALUE GBAEX_EXTENSIONS_COUNT | ||
#define GBAEX_IO_SIZE (REG_HWEX_END - REG_HWEX0_ENABLE) | ||
|
||
struct GBAExtensions { | ||
bool globalEnabled; | ||
bool extensionsEnabled[GBAEX_EXTENSIONS_COUNT]; | ||
bool userGlobalEnabled; | ||
bool userExtensionsEnabled[GBAEX_EXTENSIONS_COUNT]; | ||
|
||
// IO: | ||
uint16_t* io; | ||
|
||
// Other data | ||
uint8_t* extraRam; | ||
uint32_t extraRamSize; | ||
uint32_t extraRamRealSize; | ||
}; | ||
|
||
struct GBAExtensionsStateBlockHeader { | ||
uint32_t id; | ||
uint32_t offset; | ||
uint32_t size; | ||
}; | ||
|
||
struct GBAExtensionsState { | ||
uint32_t version; | ||
uint32_t extensionsBlockCount; | ||
|
||
struct GBAExtensionsStateBlockHeader ioBlockHeader; | ||
// More blocks can come after the IO one | ||
}; | ||
|
||
struct GBA; | ||
void GBAExtensionsInit(struct GBAExtensions* extensions); | ||
void GBAExtensionsReset(struct GBAExtensions* extensions); | ||
void GBAExtensionsDestroy(struct GBAExtensions* extensions); | ||
uint16_t GBAExtensionsIORead(struct GBA* gba, uint32_t address); | ||
uint32_t GBAExtensionsIORead32(struct GBA* gba, uint32_t address); | ||
void GBAExtensionsIOWrite8(struct GBA* gba, uint32_t address, uint8_t value); | ||
void GBAExtensionsIOWrite(struct GBA* gba, uint32_t address, uint16_t value); | ||
size_t GBAExtensionsSerialize(struct GBA* gba, void** sram); | ||
bool GBAExtensionsDeserialize(struct GBA* gba, const struct GBAExtensionsState* state, size_t size); | ||
|
||
CXX_GUARD_END | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,6 +248,15 @@ void usage(const char* arg0, const char* extraOptions) { | |
puts(" -p, --patch FILE Apply a specified patch file when running"); | ||
puts(" -s, --frameskip N Skip every N frames"); | ||
puts(" --version Print version and exit"); | ||
|
||
puts("\nHardware extensions options:"); | ||
puts(" --hw-extensions Enable hardware extensions"); | ||
puts(" --no-hw-extensions Disable hardware extensions"); | ||
puts(" --hwex-all Enable all hardware extensions"); | ||
puts(" --hwex-none Disable all hardware extensions"); | ||
puts(" --hwex-more-ram Enable hardware extension \"More RAM\""); | ||
puts(" --no-hwex-more-ram Disable hardware extension \"More RAM\""); | ||
|
||
Comment on lines
+252
to
+259
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also removed this. |
||
if (extraOptions) { | ||
puts(extraOptions); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ set(SOURCE_FILES | |
cheats/parv3.c | ||
core.c | ||
dma.c | ||
extra/extensions.c | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extras go in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I ifdef'd under MINIMAL_CORE or do I create a new define? |
||
gba.c | ||
hle-bios.c | ||
input.c | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This base seems arbitrary. How did you choose it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know what to put, so I chose something in the middle. Didn't want to put it at the end so its easy to add more and also didn't want to put it close to the real registers. Any suggestions?