[Build] Move the core emulator to src/core/

* Move src/apu/, src/gb/ and src/gba/ to src/core/.
* Clean up include guards and headers.
* Rename `BKPT_SUPPORT` to `VBAM_ENABLE_DEBUGGER` and remove the
  `NO_DEBUGGER` define.
This commit is contained in:
Fabrice de Gans 2024-03-16 13:19:05 -07:00 committed by Fabrice de Gans
parent 33cb9a66d4
commit 047bd935ea
123 changed files with 898 additions and 764 deletions

View File

@ -244,10 +244,11 @@ set(SDL2_TARGETS SDL2::SDL2 ${SDL2_LIBRARY_TEMP})
set( set(
VBAMCORE_LIBS VBAMCORE_LIBS
vbamcore vbamcore
vbam-core-apu
vbam-core-base vbam-core-base
vbam-core-emulator
vbam-fex vbam-fex
${SDL2_TARGETS} ${SDL2_TARGETS}
${SFML_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
) )
@ -333,10 +334,8 @@ else()
endif() endif()
# The debugger is enabled by default # The debugger is enabled by default
if(NOT ENABLE_DEBUGGER) if(ENABLE_DEBUGGER)
add_compile_definitions(NO_DEBUGGER) add_compile_definitions(VBAM_ENABLE_DEBUGGER)
else()
add_compile_definitions(BKPT_SUPPORT)
endif() endif()
# The ASM core is disabled by default because we don't know on which platform we are # The ASM core is disabled by default because we don't know on which platform we are
@ -386,8 +385,7 @@ endif()
if(NOT TRANSLATIONS_ONLY) if(NOT TRANSLATIONS_ONLY)
add_subdirectory(third_party/include/stb) add_subdirectory(third_party/include/stb)
add_subdirectory(src/core/fex) add_subdirectory(src/core)
add_subdirectory(src/core/base)
endif() endif()
set( set(
@ -416,120 +414,6 @@ if(ENABLE_FFMPEG)
set(HDR_MAIN ${HDR_MAIN} src/common/ffmpeg.h) set(HDR_MAIN ${HDR_MAIN} src/common/ffmpeg.h)
endif() endif()
set(
SRC_GBA
src/gba/agbprint.cpp
src/gba/bios.cpp
src/gba/Cheats.cpp
src/gba/CheatSearch.cpp
# Built with flex -o debugger-expr-lex.cpp -P dexp_ debugger-expr.l
src/gba/debugger-expr-lex.cpp
# Built with bison -L c -o debugger-expr-yacc.cpp -H -p dexp_ debugger-expr.y
# The yyerrorlab label handler was manually commented out to silence a
# compiler warning.
src/gba/debugger-expr-yacc.cpp
src/gba/EEprom.cpp
src/gba/ereader.cpp
src/gba/Flash.cpp
src/gba/GBA.cpp
src/gba/GBAGfx.cpp
src/gba/GBALink.cpp
src/gba/GBASockClient.cpp
src/gba/GBA-thumb.cpp
src/gba/GBA-arm.cpp
src/gba/gbafilter.cpp
src/gba/Globals.cpp
src/gba/Mode0.cpp
src/gba/Mode1.cpp
src/gba/Mode2.cpp
src/gba/Mode3.cpp
src/gba/Mode4.cpp
src/gba/Mode5.cpp
src/gba/RTC.cpp
src/gba/Sound.cpp
src/gba/Sram.cpp
)
if(ENABLE_DEBUGGER)
list(APPEND SRC_GBA
src/gba/BreakpointStructures.cpp
)
endif()
set(
HDR_GBA
src/gba/agbprint.h
src/gba/bios.h
src/gba/BreakpointStructures.h
src/gba/Cheats.h
src/gba/CheatSearch.h
src/gba/debugger-expr-yacc.hpp
src/gba/EEprom.h
src/gba/ereader.h
src/gba/Flash.h
src/gba/GBA.h
src/gba/GBAcpu.h
src/gba/gbafilter.h
src/gba/GBAGfx.h
src/gba/GBAinline.h
src/gba/GBALink.h
src/gba/GBASockClient.h
src/gba/Globals.h
src/gba/RTC.h
src/gba/Sound.h
src/gba/Sram.h
)
set(
SRC_GB
src/gb/GB.cpp
src/gb/gbCartData.cpp
src/gb/gbCheats.cpp
src/gb/gbDis.cpp
src/gb/gbGfx.cpp
src/gb/gbGlobals.cpp
src/gb/gbMemory.cpp
src/gb/gbPrinter.cpp
src/gb/gbSGB.cpp
src/gb/gbSound.cpp
)
set(
HDR_GB
src/gb/gb.h
src/gb/gbCartData.h
src/gb/gbCheats.h
src/gb/gbCodes.h
src/gb/gbCodesCB.h
src/gb/gbGlobals.h
src/gb/gbMemory.h
src/gb/gbPrinter.h
src/gb/gbSGB.h
src/gb/gbSound.h
)
set(
SRC_APU
src/apu/Blip_Buffer.cpp
src/apu/Effects_Buffer.cpp
src/apu/Gb_Apu.cpp
src/apu/Gb_Apu_State.cpp
src/apu/Gb_Oscs.cpp
src/apu/Multi_Buffer.cpp
)
set(
HDR_APU
src/apu/blargg_common.h #Unused(?) but in the VS projects
src/apu/blargg_config.h #Unused(?) but in the VS projects
src/apu/blargg_source.h
src/apu/Blip_Buffer.h
src/apu/Effects_Buffer.h
src/apu/Gb_Apu.h
src/apu/Gb_Oscs.h
src/apu/Multi_Buffer.h
)
set( set(
SRC_SDL SRC_SDL
src/sdl/ConfigManager.cpp src/sdl/ConfigManager.cpp
@ -614,31 +498,6 @@ else()
endif() endif()
set(
SRC_DEBUGGER
src/gba/armdis.cpp
src/gba/elf.cpp
)
set(
HDR_DEBUGGER
src/gba/armdis.h
src/gba/elf.h
)
if(ENABLE_DEBUGGER)
set(
SRC_DEBUGGER
${SRC_DEBUGGER}
src/gba/remote.cpp
)
set(
HDR_DEBUGGER
${HDR_DEBUGGER}
src/gba/remote.h
)
endif()
include_directories( include_directories(
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
third_party/include third_party/include
@ -657,16 +516,8 @@ if(NOT TRANSLATIONS_ONLY)
${PROJECT_SRCS} ${PROJECT_SRCS}
${SRC_MAIN} ${SRC_MAIN}
${HDR_MAIN} ${HDR_MAIN}
${SRC_GBA}
${HDR_GBA}
${SRC_GB}
${HDR_GB}
${SRC_APU}
${HDR_APU}
${SRC_FILTERS} ${SRC_FILTERS}
${HDR_FILTERS} ${HDR_FILTERS}
${SRC_DEBUGGER}
${HDR_DEBUGGER}
) )
target_include_directories(vbamcore PUBLIC ${SDL2_INCLUDE_DIRS}) target_include_directories(vbamcore PUBLIC ${SDL2_INCLUDE_DIRS})
endif() endif()

View File

@ -21,3 +21,32 @@ linkage:
short: Shared short: Shared
long: Create shared libraries/DLLs long: Create shared libraries/DLLs
linkage: shared linkage: shared
useLink:
default: withlink
choices:
withlink:
short: WithLink
long: Enable the Link feature
settings:
ENABLE_LINK: ON
nolink:
short: NoLink
long: Disable the Link feature
settings:
ENABLE_LINK: OFF
useDebugger:
default: withdebugger
choices:
withdebugger:
short: WithDebugger
long: Enable the Debugger feature
settings:
ENABLE_DEBUGGER: ON
nodebugger:
short: NoDebugger
long: Disable the Debugger feature
settings:
ENABLE_DEBUGGER: OFF
ENABLE_SDL: OFF

View File

@ -20,6 +20,7 @@ add_compile_definitions(
__STDC_LIMIT_MACROS __STDC_LIMIT_MACROS
__STDC_CONSTANT_MACROS __STDC_CONSTANT_MACROS
_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS
NOMINMAX
) )
add_compile_options( add_compile_options(
/W4 /W4

View File

@ -8,7 +8,7 @@ Known preprocessor switches:
- SDL: Defined for the SDL version - SDL: Defined for the SDL version
- GBA_LOGGING: Enables logging for the GBA core - GBA_LOGGING: Enables logging for the GBA core
- FINAL_VERSION: Defined for release versions, disables additional GBA logging and completely disables GB logging. Increases the amount of CPU cycles being emulated in one go. - FINAL_VERSION: Defined for release versions, disables additional GBA logging and completely disables GB logging. Increases the amount of CPU cycles being emulated in one go.
- BKPT_SUPPORT - VBAM_ENABLE_DEBUGGER: Enable remote debugging support
- MMX: Enable MMX instruction set - MMX: Enable MMX instruction set
- NO_ASM: Use C++ version of hq3x/4x filters - NO_ASM: Use C++ version of hq3x/4x filters
- RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version) - RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version)

View File

@ -4,9 +4,10 @@
#include "core/base/port.h" #include "core/base/port.h"
#include "core/base/system.h" #include "core/base/system.h"
#include "gba/Globals.h" #include "core/gba/gbaFilter.h"
#include "gba/RTC.h" #include "core/gba/gbaFlash.h"
#include "gba/gbafilter.h" #include "core/gba/gbaGlobals.h"
#include "core/gba/gbaRtc.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define strcasecmp _stricmp #define strcasecmp _stricmp

View File

@ -19,8 +19,8 @@
#include <iostream> #include <iostream>
#include <SDL_events.h> #include <SDL_events.h>
#include "SoundSDL.h" #include "SoundSDL.h"
#include "../gba/Globals.h" #include "core/gba/gbaGlobals.h"
#include "../gba/Sound.h" #include "core/gba/gbaSound.h"
extern int emulating; extern int emulating;

131
src/core/CMakeLists.txt Normal file
View File

@ -0,0 +1,131 @@
add_subdirectory(apu)
add_subdirectory(base)
add_subdirectory(fex)
# The vbam-core-emulator target contains both the Game Boy and Game Boy Advance
# emulators. These should be broken down into 2 separate targets. The issue lies
# with the Link and Sound emulation, which are tangled together between the two
# systems.
add_library(vbam-core-emulator OBJECT)
target_sources(vbam-core-emulator
PRIVATE
# Game Boy
gb/internal/gbCodes.h
gb/internal/gbCodesCB.h
gb/gb.cpp
gb/gbCartData.cpp
gb/gbCheats.cpp
gb/gbDis.cpp
gb/gbGfx.cpp
gb/gbGlobals.cpp
gb/gbMemory.cpp
gb/gbPrinter.cpp
gb/gbSGB.cpp
gb/gbSound.cpp
# Game Boy Advance
# Built with flex -o debugger-expr-lex.cpp -P dexp_ debugger-expr.l
gba/debugger-expr-lex.cpp
# Built with bison -L c -o debugger-expr-yacc.cpp -H -p dexp_ debugger-expr.y
# The yyerrorlab label handler was manually commented out to silence a
# compiler warning.
gba/debugger-expr-yacc.cpp
gba/gba.cpp
gba/gbaCpuArm.cpp
gba/gbaCpuArmDis.cpp
gba/gbaCpuThumb.cpp
gba/gbaCheats.cpp
gba/gbaCheatSearch.cpp
gba/gbaEeprom.cpp
gba/gbaElf.cpp
gba/gbaFilter.cpp
gba/gbaFlash.cpp
gba/gbaGfx.cpp
gba/gbaGlobals.cpp
gba/gbaMode0.cpp
gba/gbaMode1.cpp
gba/gbaMode2.cpp
gba/gbaMode3.cpp
gba/gbaMode4.cpp
gba/gbaMode5.cpp
gba/gbaPrint.cpp
gba/gbaRtc.cpp
gba/gbaSound.cpp
gba/internal/gbaBios.cpp
gba/internal/gbaBios.h
gba/internal/gbaEreader.cpp
gba/internal/gbaEreader.h
gba/internal/gbaSram.cpp
gba/internal/gbaSram.h
PUBLIC
# Game Boy
gb/gb.h
gb/gbCartData.h
gb/gbCheats.h
gb/gbDis.h
gb/gbGfx.h
gb/gbGlobals.h
gb/gbMemory.h
gb/gbPrinter.h
gb/gbSGB.h
gb/gbSound.h
# Game Boy Advance
gba/gba.h
gba/gbaCheats.h
gba/gbaCheatSearch.h
gba/gbaCpu.h
gba/gbaCpuArmDis.h
gba/gbaEeprom.h
gba/gbaElf.h
gba/gbaFilter.h
gba/gbaFlash.h
gba/gbaGfx.h
gba/gbaGlobals.h
gba/gbaInline.h
gba/gbaPrint.h
gba/gbaRtc.h
gba/gbaSound.h
)
target_include_directories(vbam-core-base
PUBLIC ${ZLIB_INCLUDE_DIR}
)
target_link_libraries(vbam-core-emulator
PRIVATE vbam-core-apu
PUBLIC vbam-core-base ${ZLIB_LIBRARY}
)
if(ENABLE_DEBUGGER)
target_sources(vbam-core-emulator
PRIVATE
gba/gbaRemote.cpp
gba/internal/gbaBreakpoint.cpp
gba/internal/gbaBreakpoint.h
PUBLIC
gba/gbaRemote.h
)
endif()
if(ENABLE_LINK)
target_sources(vbam-core-emulator
PRIVATE
gba/gbaLink.cpp
gba/internal/gbaSockClient.cpp
gba/internal/gbaSockClient.h
PUBLIC
gba/gbaLink.h
)
target_include_directories(vbam-core-emulator
PRIVATE ${SFML_INCLUDE_DIR})
target_link_libraries(vbam-core-emulator
PRIVATE ${SFML_LIBRARIES})
endif()

View File

@ -1,6 +1,6 @@
// Blip_Buffer 0.4.1. http://www.slack.net/~ant/ // Blip_Buffer 0.4.1. http://www.slack.net/~ant/
#include "Blip_Buffer.h" #include "core/apu/Blip_Buffer.h"
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>

View File

@ -0,0 +1,24 @@
# This defines the `vbam-core-apu` target.
# `vbam-core-apu` contains the core APU emulation code.
add_library(vbam-core-apu OBJECT)
target_sources(vbam-core-apu
PRIVATE
Blip_Buffer.cpp
Effects_Buffer.cpp
Gb_Apu.cpp
Gb_Apu_State.cpp
Gb_Oscs.cpp
Multi_Buffer.cpp
PUBLIC
blargg_common.h
blargg_config.h
blargg_source.h
Blip_Buffer.h
Effects_Buffer.h
Gb_Apu.h
Gb_Oscs.h
Multi_Buffer.h
)

View File

@ -1,6 +1,6 @@
// Game_Music_Emu $vers. http://www.slack.net/~ant/ // Game_Music_Emu $vers. http://www.slack.net/~ant/
#include "Effects_Buffer.h" #include "core/apu/Effects_Buffer.h"
#include <string.h> #include <string.h>
@ -15,7 +15,7 @@ details. You should have received a copy of the GNU Lesser General Public
License along with this module; if not, write to the Free Software Foundation, License along with this module; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "blargg_source.h" #include "core/apu/blargg_source.h"
int const fixed_shift = 12; int const fixed_shift = 12;
#define TO_FIXED( f ) fixed_t ((f) * ((fixed_t) 1 << fixed_shift)) #define TO_FIXED( f ) fixed_t ((f) * ((fixed_t) 1 << fixed_shift))

View File

@ -6,7 +6,7 @@
#include <vector> #include <vector>
#include "Multi_Buffer.h" #include "core/apu/Multi_Buffer.h"
// See Simple_Effects_Buffer (below) for a simpler interface // See Simple_Effects_Buffer (below) for a simpler interface

View File

@ -1,6 +1,6 @@
// Gb_Snd_Emu 0.2.0. http://www.slack.net/~ant/ // Gb_Snd_Emu 0.2.0. http://www.slack.net/~ant/
#include "Gb_Apu.h" #include "core/apu/Gb_Apu.h"
/* Copyright (C) 2003-2007 Shay Green. This module is free software; you /* Copyright (C) 2003-2007 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser can redistribute it and/or modify it under the terms of the GNU Lesser
@ -13,7 +13,7 @@ details. You should have received a copy of the GNU Lesser General Public
License along with this module; if not, write to the Free Software Foundation, License along with this module; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "blargg_source.h" #include "core/apu/blargg_source.h"
unsigned const vol_reg = 0xFF24; unsigned const vol_reg = 0xFF24;
unsigned const stereo_reg = 0xFF25; unsigned const stereo_reg = 0xFF25;

View File

@ -6,8 +6,8 @@
#include <cstdint> #include <cstdint>
#include "blargg_common.h" #include "core/apu/blargg_common.h"
#include "Gb_Oscs.h" #include "core/apu/Gb_Oscs.h"
struct gb_apu_state_t; struct gb_apu_state_t;

View File

@ -1,6 +1,6 @@
// Gb_Snd_Emu $vers. http://www.slack.net/~ant/ // Gb_Snd_Emu $vers. http://www.slack.net/~ant/
#include "Gb_Apu.h" #include "core/apu/Gb_Apu.h"
#include <string.h> #include <string.h>
@ -15,7 +15,7 @@ details. You should have received a copy of the GNU Lesser General Public
License along with this module; if not, write to the Free Software Foundation, License along with this module; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "blargg_source.h" #include "core/apu/blargg_source.h"
#if GB_APU_CUSTOM_STATE #if GB_APU_CUSTOM_STATE
#define REFLECT( x, y ) (save ? (io->y) = (x) : (x) = (io->y) ) #define REFLECT( x, y ) (save ? (io->y) = (x) : (x) = (io->y) )

View File

@ -1,6 +1,6 @@
// Gb_Snd_Emu 0.2.0. http://www.slack.net/~ant/ // Gb_Snd_Emu 0.2.0. http://www.slack.net/~ant/
#include "Gb_Apu.h" #include "core/apu/Gb_Apu.h"
/* Copyright (C) 2003-2007 Shay Green. This module is free software; you /* Copyright (C) 2003-2007 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser can redistribute it and/or modify it under the terms of the GNU Lesser
@ -13,7 +13,7 @@ details. You should have received a copy of the GNU Lesser General Public
License along with this module; if not, write to the Free Software Foundation, License along with this module; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "blargg_source.h" #include "core/apu/blargg_source.h"
bool const cgb_02 = false; // enables bug in early CGB units that causes problems in some games bool const cgb_02 = false; // enables bug in early CGB units that causes problems in some games
bool const cgb_05 = false; // enables CGB-05 zombie behavior bool const cgb_05 = false; // enables CGB-05 zombie behavior

View File

@ -6,7 +6,7 @@
#include <cstdint> #include <cstdint>
#include "Blip_Buffer.h" #include "core/apu/Blip_Buffer.h"
#ifndef GB_APU_OVERCLOCK #ifndef GB_APU_OVERCLOCK
#define GB_APU_OVERCLOCK 1 #define GB_APU_OVERCLOCK 1

View File

@ -1,6 +1,6 @@
// Blip_Buffer 0.4.1. http://www.slack.net/~ant/ // Blip_Buffer 0.4.1. http://www.slack.net/~ant/
#include "Multi_Buffer.h" #include "core/apu/Multi_Buffer.h"
/* Copyright (C) 2003-2007 Shay Green. This module is free software; you /* Copyright (C) 2003-2007 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser can redistribute it and/or modify it under the terms of the GNU Lesser
@ -13,7 +13,7 @@ details. You should have received a copy of the GNU Lesser General Public
License along with this module; if not, write to the Free Software Foundation, License along with this module; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "blargg_source.h" #include "core/apu/blargg_source.h"
#ifdef BLARGG_ENABLE_OPTIMIZER #ifdef BLARGG_ENABLE_OPTIMIZER
#include BLARGG_ENABLE_OPTIMIZER #include BLARGG_ENABLE_OPTIMIZER

View File

@ -4,8 +4,8 @@
#ifndef MULTI_BUFFER_H #ifndef MULTI_BUFFER_H
#define MULTI_BUFFER_H #define MULTI_BUFFER_H
#include "Blip_Buffer.h" #include "core/apu/Blip_Buffer.h"
#include "blargg_common.h" #include "core/apu/blargg_common.h"
// Interface to one or more Blip_Buffers mapped to one or more channels // Interface to one or more Blip_Buffers mapped to one or more channels
// consisting of left, center, and right buffers. // consisting of left, center, and right buffers.

View File

@ -12,7 +12,7 @@
#undef BLARGG_COMMON_H #undef BLARGG_COMMON_H
// allow blargg_config.h to #include blargg_common.h // allow blargg_config.h to #include blargg_common.h
#include "blargg_config.h" #include "core/apu/blargg_config.h"
#ifndef BLARGG_COMMON_H #ifndef BLARGG_COMMON_H
#define BLARGG_COMMON_H #define BLARGG_COMMON_H

View File

@ -1,4 +1,4 @@
#include "gb.h" #include "core/gb/gb.h"
#include <array> #include <array>
#include <cassert> #include <cassert>
@ -8,17 +8,21 @@
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include "../gba/GBALink.h"
#include "../gba/Sound.h"
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "core/base/message.h" #include "core/base/message.h"
#include "core/base/sizes.h" #include "core/base/sizes.h"
#include "core/base/system.h" #include "core/base/system.h"
#include "gbCheats.h" #include "core/gb/gbCheats.h"
#include "gbGlobals.h" #include "core/gb/gbGfx.h"
#include "gbMemory.h" #include "core/gb/gbGlobals.h"
#include "gbSGB.h" #include "core/gb/gbMemory.h"
#include "gbSound.h" #include "core/gb/gbSGB.h"
#include "core/gb/gbSound.h"
#include "core/gba/gbaSound.h"
#if !defined(NO_LINK)
#include "core/gba/gbaLink.h"
#endif // !defined(NOLINK)
#if !defined(__LIBRETRO__) #if !defined(__LIBRETRO__)
#include "core/base/image_util.h" #include "core/base/image_util.h"
@ -4809,10 +4813,10 @@ void gbEmulate(int ticksToStop)
case 0xCB: case 0xCB:
// extended opcode // extended opcode
switch (opcode2) { switch (opcode2) {
#include "gbCodesCB.h" #include "core/gb/internal/gbCodesCB.h"
} }
break; break;
#include "gbCodes.h" #include "core/gb/internal/gbCodes.h"
} }
execute = false; execute = false;

View File

@ -1,14 +1,9 @@
#ifndef GB_H #ifndef VBAM_CORE_GB_GB_H_
#define GB_H #define VBAM_CORE_GB_GB_H_
#include <cstdint> #include <cstdint>
#include "gbCartData.h" #include "core/gb/gbCartData.h"
#define gbWidth 160
#define gbHeight 144
#define sgbWidth 256
#define sgbHeight 224
const int GB_C_FLAG = 0x10; const int GB_C_FLAG = 0x10;
const int GB_H_FLAG = 0x20; const int GB_H_FLAG = 0x20;
@ -28,7 +23,6 @@ typedef union {
extern gbRegister AF, BC, DE, HL, SP, PC; extern gbRegister AF, BC, DE, HL, SP, PC;
extern uint16_t IFF; extern uint16_t IFF;
int gbDis(char*, uint16_t);
// Attempts to load the ROM file at `filename`. Returns true on success. // Attempts to load the ROM file at `filename`. Returns true on success.
bool gbLoadRom(const char* filename); bool gbLoadRom(const char* filename);
@ -67,4 +61,4 @@ extern int gbHardware;
extern gbCartData g_gbCartData; extern gbCartData g_gbCartData;
extern struct EmulatedSystem GBSystem; extern struct EmulatedSystem GBSystem;
#endif // GB_H #endif // VBAM_CORE_GB_GB_H_

View File

@ -1,4 +1,4 @@
#include "gbCartData.h" #include "core/gb/gbCartData.h"
#include <algorithm> #include <algorithm>
#include <array> #include <array>

View File

@ -1,7 +1,6 @@
#ifndef VBAM_GB_GB_ROM_H_ #ifndef VBAM_CORE_GB_GBCARTDATA_H_
#define VBAM_GB_GB_ROM_H_ #define VBAM_CORE_GB_GBCARTDATA_H_
#include <cassert>
#include <cstdint> #include <cstdint>
#include <string> #include <string>
@ -201,4 +200,4 @@ private:
uint16_t actual_global_checksum_ = 0; uint16_t actual_global_checksum_ = 0;
}; };
#endif // VBAM_GB_GB_ROM_H_ #endif // VBAM_CORE_GB_GBCARTDATA_H_

View File

@ -1,15 +1,14 @@
#include "gbCheats.h" #include "core/gb/gbCheats.h"
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "core/base/file_util.h"
#include "core/base/message.h" #include "core/base/message.h"
#include "core/base/system.h" #include "core/base/system.h"
#include "core/gb/gb.h"
#include "core/base/file_util.h" #include "core/gb/gbGlobals.h"
#include "gb.h"
#include "gbGlobals.h"
gbCheat gbCheatList[MAX_CHEATS]; gbCheat gbCheatList[MAX_CHEATS];
int gbCheatNumber = 0; int gbCheatNumber = 0;

View File

@ -1,5 +1,5 @@
#ifndef GBCHEATS_H #ifndef VBAM_CORE_GB_GBCHEATS_H_
#define GBCHEATS_H #define VBAM_CORE_GB_GBCHEATS_H_
#include <cstdint> #include <cstdint>
@ -48,4 +48,4 @@ extern int gbCheatNumber;
extern gbCheat gbCheatList[MAX_CHEATS]; extern gbCheat gbCheatList[MAX_CHEATS];
extern bool gbCheatMap[0x10000]; extern bool gbCheatMap[0x10000];
#endif // GBCHEATS_H #endif // VBAM_CORE_GB_GBCHEATS_H_

View File

@ -1,6 +1,8 @@
#include "core/gb/gbDis.h"
#include <cstdio> #include <cstdio>
#include "gbGlobals.h" #include "core/gb/gbGlobals.h"
typedef struct { typedef struct {
uint8_t mask; uint8_t mask;

8
src/core/gb/gbDis.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef VBAM_CORE_GB_GBDIS_H_
#define VBAM_CORE_GB_GBDIS_H_
#include <cstdint>
int gbDis(char*, uint16_t);
#endif // VBAM_CORE_GB_GBDIS_H_

View File

@ -1,8 +1,10 @@
#include "core/gb/gbGfx.h"
#include <memory.h> #include <memory.h>
#include "core/base/system.h" #include "core/base/system.h"
#include "gbGlobals.h" #include "core/gb/gbGlobals.h"
#include "gbSGB.h" #include "core/gb/gbSGB.h"
uint8_t gbInvertTab[256] = { uint8_t gbInvertTab[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,

7
src/core/gb/gbGfx.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef VBAM_CORE_GB_GBGFX_H_
#define VBAM_CORE_GB_GBGFX_H_
void gbRenderLine();
void gbDrawSprites(bool);
#endif // VBAM_CORE_GB_GBGFX_H_

View File

@ -1,4 +1,4 @@
#include "gbGlobals.h" #include "core/gb/gbGlobals.h"
uint8_t* gbMemoryMap[16]; uint8_t* gbMemoryMap[16];

View File

@ -1,5 +1,5 @@
#ifndef GBGLOBALS_H #ifndef VBAM_CORE_GB_GBGLOBALS_H_
#define GBGLOBALS_H #define VBAM_CORE_GB_GBGLOBALS_H_
#include <cstdint> #include <cstdint>
@ -59,9 +59,6 @@ extern int gbBorderRowSkip;
extern int gbBorderColumnSkip; extern int gbBorderColumnSkip;
extern int gbDmaTicks; extern int gbDmaTicks;
extern void gbRenderLine();
extern void gbDrawSprites(bool);
extern uint8_t (*gbSerialFunction)(uint8_t); extern uint8_t (*gbSerialFunction)(uint8_t);
#endif // GBGLOBALS_H #endif // VBAM_CORE_GB_GBGLOBALS_H_

View File

@ -1,16 +1,15 @@
#include "gbMemory.h" #include "core/gb/gbMemory.h"
#include <cstdint> #include <cstdint>
#include "core/base/port.h" #include "core/base/port.h"
#include "core/base/sizes.h" #include "core/base/sizes.h"
#include "core/base/system.h" #include "core/base/system.h"
#include "gb.h" #include "core/gb/gb.h"
#include "gbGlobals.h" #include "core/gb/gbGlobals.h"
uint8_t gbDaysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; uint8_t gbDaysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
extern int gbGBCColorType; extern int gbGBCColorType;
extern gbRegister PC;
mapperMBC1 gbDataMBC1 = { mapperMBC1 gbDataMBC1 = {
0, // RAM enable 0, // RAM enable

View File

@ -1,5 +1,5 @@
#ifndef GBMEMORY_H #ifndef VBAM_CORE_GB_GBMEMORY_H_
#define GBMEMORY_H #define VBAM_CORE_GB_GBMEMORY_H_
#include <cstdint> #include <cstdint>
#include <ctime> #include <ctime>
@ -209,4 +209,4 @@ extern void memoryUpdateMapGS3();
#define HUC3_RTC_DATA_SIZE sizeof(int) * 4 + sizeof(uint64_t) #define HUC3_RTC_DATA_SIZE sizeof(int) * 4 + sizeof(uint64_t)
#endif // GBMEMORY_H #endif // VBAM_CORE_GB_GBMEMORY_H_

View File

@ -1,4 +1,4 @@
#include "gbPrinter.h" #include "core/gb/gbPrinter.h"
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>

8
src/core/gb/gbPrinter.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef VBAM_CORE_GB_GBPRINTER_H_
#define VBAM_CORE_GB_GBPRINTER_H_
#include <cstdint>
uint8_t gbPrinterSend(uint8_t b);
#endif // VBAM_CORE_GB_GBPRINTER_H_

View File

@ -1,11 +1,13 @@
#include <memory.h> #include "core/gb/gbSGB.h"
#include <stdlib.h>
#include <cstdlib>
#include <cstring>
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "core/base/system.h" #include "core/base/system.h"
#include "gb.h" #include "core/gb/gb.h"
#include "gbGlobals.h" #include "core/gb/gbGlobals.h"
extern uint8_t* g_pix; extern uint8_t* g_pix;
extern bool speedup; extern bool speedup;

View File

@ -1,5 +1,5 @@
#ifndef GBSGB_H #ifndef VBAM_CORE_GB_GBSGB_H_
#define GBSGB_H #define VBAM_CORE_GB_GBSGB_H_
#include <cstdint> #include <cstdint>
@ -30,4 +30,4 @@ extern int gbSgbPacketTimeout;
extern uint8_t gbSgbReadingController; extern uint8_t gbSgbReadingController;
extern int gbSgbFourPlayers; extern int gbSgbFourPlayers;
#endif // GBSGB_H #endif // VBAM_CORE_GB_GBSGB_H_

View File

@ -2,14 +2,14 @@
#include <cstring> #include <cstring>
#include "core/apu/Effects_Buffer.h"
#include "core/apu/Gb_Apu.h"
#include "core/base/system.h" #include "core/base/system.h"
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "../gba/Sound.h" #include "core/gb/gb.h"
#include "gb.h" #include "core/gb/gbGlobals.h"
#include "gbGlobals.h" #include "core/gba/gbaSound.h"
#include "../apu/Effects_Buffer.h"
#include "../apu/Gb_Apu.h"
extern long soundSampleRate; // current sound quality extern long soundSampleRate; // current sound quality

View File

@ -1,5 +1,5 @@
#ifndef GBSOUND_H #ifndef VBAM_CORE_GB_GBSOUND_H_
#define GBSOUND_H #define VBAM_CORE_GB_GBSOUND_H_
#include <cstdint> #include <cstdint>
@ -82,4 +82,4 @@ void gbSoundSaveGame(gzFile out);
void gbSoundReadGame(int version, gzFile in); void gbSoundReadGame(int version, gzFile in);
#endif #endif
#endif // GBSOUND_H #endif // VBAM_CORE_GB_GBSOUND_H_

View File

@ -78,8 +78,9 @@
#include <stdio.h> #include <stdio.h>
#include "GBA.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#include <string> #include <string>
#include <map> #include <map>

View File

@ -1,8 +1,9 @@
%{ %{
#include <stdio.h> #include <stdio.h>
#include "GBA.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#include <string> #include <string>
#include <map> #include <map>

View File

@ -1,9 +1,10 @@
#include "core/gba/gba.h"
#include <cmath> #include <cmath>
#include <memory.h> #include <cstddef>
#include <stddef.h> #include <cstdio>
#include <stdio.h> #include <cstdlib>
#include <stdlib.h> #include <cstring>
#include <string.h>
#ifndef _MSC_VER #ifndef _MSC_VER
#include <strings.h> #include <strings.h>
@ -11,24 +12,29 @@
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "core/base/message.h" #include "core/base/message.h"
#include "core/base/system.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "core/base/sizes.h" #include "core/base/sizes.h"
#include "Cheats.h" #include "core/base/system.h"
#include "EEprom.h" #include "core/gba/gbaCheats.h"
#include "Flash.h" #include "core/gba/gbaCpu.h"
#include "GBA.h" #include "core/gba/gbaEeprom.h"
#include "GBAGfx.h" #include "core/gba/gbaFlash.h"
#include "GBALink.h" #include "core/gba/gbaGlobals.h"
#include "GBAcpu.h" #include "core/gba/gbaGfx.h"
#include "GBAinline.h" #include "core/gba/gbaInline.h"
#include "Globals.h" #include "core/gba/gbaPrint.h"
#include "Sound.h" #include "core/gba/gbaSound.h"
#include "Sram.h" #include "core/gba/internal/gbaBios.h"
#include "agbprint.h" #include "core/gba/internal/gbaEreader.h"
#include "bios.h" #include "core/gba/internal/gbaSram.h"
#include "elf.h"
#include "ereader.h" #if defined(VBAM_ENABLE_DEBUGGER)
#include "core/gba/gbaElf.h"
#endif // defined(VBAM_ENABLE_DEBUGGER)
#if !defined(NO_LINK)
#include "core/gba/gbaLink.h"
#endif // !defined(NOLINK)
#if !defined(__LIBRETRO__) #if !defined(__LIBRETRO__)
#include "core/base/image_util.h" #include "core/base/image_util.h"
@ -47,7 +53,7 @@
#endif #endif
extern int emulating; extern int emulating;
bool debugger; bool debugger = false;
int SWITicks = 0; int SWITicks = 0;
int IRQTicks = 0; int IRQTicks = 0;
@ -85,7 +91,7 @@ int profilingTicksReload = 0;
static profile_segment* profilSegment = NULL; static profile_segment* profilSegment = NULL;
#endif #endif
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
uint8_t freezeWorkRAM[SIZE_WRAM]; uint8_t freezeWorkRAM[SIZE_WRAM];
uint8_t freezeInternalRAM[SIZE_IRAM]; uint8_t freezeInternalRAM[SIZE_IRAM];
uint8_t freezeVRAM[0x18000]; uint8_t freezeVRAM[0x18000];
@ -1423,9 +1429,9 @@ void CPUCleanUp()
g_ioMem = NULL; g_ioMem = NULL;
} }
#ifndef NO_DEBUGGER #if defined(VBAM_ENABLE_DEBUGGER)
elfCleanUp(); elfCleanUp();
#endif //NO_DEBUGGER #endif // defined(VBAM_ENABLE_DEBUGGER)
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
@ -1447,7 +1453,7 @@ void SetMapMasks()
map[12].mask = 0x1FFFFFF; map[12].mask = 0x1FFFFFF;
map[14].mask = 0xFFFF; map[14].mask = 0xFFFF;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
map[i].size = map[i].mask + 1; map[i].size = map[i].mask + 1;
map[i].trace = NULL; map[i].trace = NULL;
@ -1497,7 +1503,7 @@ int CPULoadRom(const char* szFile)
uint8_t* whereToLoad = coreOptions.cpuIsMultiBoot ? g_workRAM : g_rom; uint8_t* whereToLoad = coreOptions.cpuIsMultiBoot ? g_workRAM : g_rom;
#ifndef NO_DEBUGGER #if defined(VBAM_ENABLE_DEBUGGER)
if (CPUIsELF(szFile)) { if (CPUIsELF(szFile)) {
FILE* f = utilOpenFile(szFile, "rb"); FILE* f = utilOpenFile(szFile, "rb");
if (!f) { if (!f) {
@ -1519,7 +1525,7 @@ int CPULoadRom(const char* szFile)
return 0; return 0;
} }
} else } else
#endif //NO_DEBUGGER #endif // defined(VBAM_ENABLE_DEBUGGER)
if (szFile != NULL) { if (szFile != NULL) {
if (!utilLoad(szFile, if (!utilLoad(szFile,
utilIsGBAImage, utilIsGBAImage,
@ -2018,7 +2024,7 @@ void CPUSoftwareInterrupt(int comment)
static bool disableMessage = false; static bool disableMessage = false;
if (armState) if (armState)
comment >>= 16; comment >>= 16;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (comment == 0xff) { if (comment == 0xff) {
dbgOutput(NULL, reg[0].I); dbgOutput(NULL, reg[0].I);
return; return;

View File

@ -1,5 +1,5 @@
#ifndef GBA_H #ifndef VBAM_CORE_GBA_GBA_H_
#define GBA_H #define VBAM_CORE_GBA_GBA_H_
#include <cstdint> #include <cstdint>
@ -58,7 +58,7 @@ enum {
typedef struct { typedef struct {
uint8_t* address; uint8_t* address;
uint32_t mask; uint32_t mask;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
uint8_t* breakPoints; uint8_t* breakPoints;
uint8_t* searchMatch; uint8_t* searchMatch;
uint8_t* trace; uint8_t* trace;
@ -108,8 +108,9 @@ extern bool cpuSramEnabled;
extern bool cpuFlashEnabled; extern bool cpuFlashEnabled;
extern bool cpuEEPROMEnabled; extern bool cpuEEPROMEnabled;
extern bool cpuEEPROMSensorEnabled; extern bool cpuEEPROMSensorEnabled;
extern bool debugger;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
extern uint8_t freezeWorkRAM[0x40000]; extern uint8_t freezeWorkRAM[0x40000];
extern uint8_t freezeInternalRAM[0x8000]; extern uint8_t freezeInternalRAM[0x8000];
extern uint8_t freezeVRAM[0x18000]; extern uint8_t freezeVRAM[0x18000];
@ -118,7 +119,6 @@ extern uint8_t freezePRAM[0x400];
extern bool debugger_last; extern bool debugger_last;
extern int oldreg[18]; extern int oldreg[18];
extern char oldbuffer[10]; extern char oldbuffer[10];
extern bool debugger;
#endif #endif
extern bool CPUReadGSASnapshot(const char*); extern bool CPUReadGSASnapshot(const char*);
@ -195,9 +195,26 @@ extern struct EmulatedSystem GBASystem;
#define R14_FIQ 43 #define R14_FIQ 43
#define SPSR_FIQ 44 #define SPSR_FIQ 44
#include "Cheats.h" // register definitions
#include "EEprom.h" #define COMM_SIODATA32_L 0x120 // Lower 16bit on Normal mode
#include "Flash.h" #define COMM_SIODATA32_H 0x122 // Higher 16bit on Normal mode
#include "Globals.h" #define COMM_SIOCNT 0x128
#define COMM_SIODATA8 0x12a // 8bit on Normal/UART mode, (up to 4x8bit with FIFO)
#define COMM_SIOMLT_SEND 0x12a // SIOMLT_SEND (16bit R/W) on MultiPlayer mode (local outgoing)
#define COMM_SIOMULTI0 0x120 // SIOMULTI0 (16bit) on MultiPlayer mode (Parent/Master)
#define COMM_SIOMULTI1 0x122 // SIOMULTI1 (16bit) on MultiPlayer mode (Child1/Slave1)
#define COMM_SIOMULTI2 0x124 // SIOMULTI2 (16bit) on MultiPlayer mode (Child2/Slave2)
#define COMM_SIOMULTI3 0x126 // SIOMULTI3 (16bit) on MultiPlayer mode (Child3/Slave3)
#define COMM_RCNT 0x134 // SIO Mode (4bit data) on GeneralPurpose mode
#define COMM_IR 0x136 // Infrared Register (16bit) 1bit data at a time(LED On/Off)?
#define COMM_JOYCNT 0x140
#define COMM_JOY_RECV_L 0x150 // Send/Receive 8bit Lower first then 8bit Higher
#define COMM_JOY_RECV_H 0x152
#define COMM_JOY_TRANS_L 0x154 // Send/Receive 8bit Lower first then 8bit Higher
#define COMM_JOY_TRANS_H 0x156
#define COMM_JOYSTAT 0x158 // Send/Receive 8bit lower only
#endif // GBA_H #define JOYSTAT_RECV 2
#define JOYSTAT_SEND 8
#endif // VBAM_CORE_GBA_GBA_H_

View File

@ -1,7 +1,7 @@
#include <memory.h> #include "core/gba/gbaCheatSearch.h"
#include <stdlib.h>
#include "CheatSearch.h" #include <cstdlib>
#include <cstring>
CheatSearchBlock cheatSearchBlocks[4]; CheatSearchBlock cheatSearchBlocks[4];

View File

@ -1,5 +1,5 @@
#ifndef CHEATSEARCH_H #ifndef VBAM_CORE_GBA_GBACHEATSEARCH_H_
#define CHEATSEARCH_H #define VBAM_CORE_GBA_GBACHEATSEARCH_H_
#include <cstdint> #include <cstdint>
@ -44,4 +44,4 @@ void cheatSearchUpdateValues(const CheatSearchData* cs);
int32_t cheatSearchSignedRead(uint8_t* data, int off, int size); int32_t cheatSearchSignedRead(uint8_t* data, int off, int size);
uint32_t cheatSearchRead(uint8_t* data, int off, int size); uint32_t cheatSearchRead(uint8_t* data, int off, int size);
#endif // CHEATSEARCH_H #endif // VBAM_CORE_GBA_GBACHEATSEARCH_H_

View File

@ -1,13 +1,13 @@
#include "Cheats.h" #include "core/gba/gbaCheats.h"
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "core/base/message.h" #include "core/base/message.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "GBAinline.h" #include "core/gba/gbaInline.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
/** /**
* Gameshark code types: (based on AR v1.0) * Gameshark code types: (based on AR v1.0)
@ -2802,7 +2802,7 @@ extern int cpuNextEvent;
extern void debuggerBreakOnWrite(uint32_t, uint32_t, uint32_t, int, int); extern void debuggerBreakOnWrite(uint32_t, uint32_t, uint32_t, int, int);
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
static uint8_t cheatsGetType(uint32_t address) static uint8_t cheatsGetType(uint32_t address)
{ {
switch (address >> 24) { switch (address >> 24) {
@ -2824,7 +2824,7 @@ static uint8_t cheatsGetType(uint32_t address)
} }
#endif #endif
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
void cheatsWriteMemory(uint32_t address, uint32_t value) void cheatsWriteMemory(uint32_t address, uint32_t value)
{ {
if (cheatsNumber == 0) { if (cheatsNumber == 0) {

View File

@ -1,5 +1,5 @@
#ifndef CHEATS_H #ifndef VBAM_CORE_GBA_GBACHEATS_H_
#define CHEATS_H #define VBAM_CORE_GBA_GBACHEATS_H_
#include <cstdint> #include <cstdint>
@ -39,7 +39,7 @@ void cheatsReadGameSkip(gzFile file, int version);
void cheatsSaveCheatList(const char* file); void cheatsSaveCheatList(const char* file);
bool cheatsLoadCheatList(const char* file); bool cheatsLoadCheatList(const char* file);
#endif #endif
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
void cheatsWriteMemory(uint32_t address, uint32_t value); void cheatsWriteMemory(uint32_t address, uint32_t value);
void cheatsWriteHalfWord(uint32_t address, uint16_t value); void cheatsWriteHalfWord(uint32_t address, uint16_t value);
void cheatsWriteByte(uint32_t address, uint8_t value); void cheatsWriteByte(uint32_t address, uint8_t value);
@ -49,4 +49,4 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended);
extern int cheatsNumber; extern int cheatsNumber;
extern CheatsData cheatsList[MAX_CHEATS]; extern CheatsData cheatsList[MAX_CHEATS];
#endif // CHEATS_H #endif // VBAM_CORE_GBA_GBACHEATS_H_

View File

@ -1,5 +1,11 @@
#ifndef GBACPU_H #ifndef VBAM_CORE_GBA_GBACPU_H_
#define GBACPU_H #define VBAM_CORE_GBA_GBACPU_H_
#include <cstdint>
#include "core/base/system.h"
#include "core/gba/gbaCheats.h"
#include "core/gba/gbaGlobals.h"
extern int armExecute(); extern int armExecute();
extern int thumbExecute(); extern int thumbExecute();
@ -234,4 +240,4 @@ inline void cpuMasterCodeCheck()
} }
} }
#endif // GBACPU_H #endif // VBAM_CORE_GBA_GBACPU_H_

View File

@ -1,8 +1,12 @@
#include "GBA.h" #include "core/gba/gba.h"
#include "GBAcpu.h"
#include "GBAinline.h" #include "core/gba/gbaCpu.h"
#include "Globals.h" #include "core/gba/gbaInline.h"
#include "remote.h" #include "core/gba/gbaGlobals.h"
#if defined(VBAM_ENABLE_DEBUGGER)
#include "core/gba/gbaRemote.h"
#endif // defined(VBAM_ENABLE_DEBUGGER)
#ifdef PROFILING #ifdef PROFILING
#include "prof/prof.h" #include "prof/prof.h"
@ -31,7 +35,7 @@ static INSN_REGPARM void armUnknownInsn(uint32_t opcode)
CPUUndefinedException(); CPUUndefinedException();
} }
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
static INSN_REGPARM void armBreakpoint(uint32_t opcode) static INSN_REGPARM void armBreakpoint(uint32_t opcode)
{ {
reg[15].I -= 4; reg[15].I -= 4;
@ -81,7 +85,7 @@ static void count(uint32_t opcode, int cond_res)
// Common macros ////////////////////////////////////////////////////////// // Common macros //////////////////////////////////////////////////////////
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
#define CONSOLE_OUTPUT(a, b) \ #define CONSOLE_OUTPUT(a, b) \
do { \ do { \
if ((opcode == 0xe0000000) && (reg[0].I == 0xC0DED00D)) { \ if ((opcode == 0xe0000000) && (reg[0].I == 0xC0DED00D)) { \
@ -2610,7 +2614,7 @@ typedef INSN_REGPARM void (*insnfunc_t)(uint32_t opcode);
REP16(insn), REP16(insn), REP16(insn), REP16(insn), \ REP16(insn), REP16(insn), REP16(insn), REP16(insn), \
REP16(insn), REP16(insn), REP16(insn), REP16(insn) REP16(insn), REP16(insn), REP16(insn), REP16(insn)
#define arm_UI armUnknownInsn #define arm_UI armUnknownInsn
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
#define arm_BP armBreakpoint #define arm_BP armBreakpoint
#else #else
#define arm_BP armUnknownInsn #define arm_BP armUnknownInsn
@ -2839,7 +2843,7 @@ int armExecute()
reg[15].I += 4; reg[15].I += 4;
ARM_PREFETCH_NEXT; ARM_PREFETCH_NEXT;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
uint32_t memAddr = armNextPC; uint32_t memAddr = armNextPC;
memoryMap* m = &map[memAddr >> 24]; memoryMap* m = &map[memAddr >> 24];
if (m->breakPoints && BreakARMCheck(m->breakPoints, memAddr & m->mask)) { if (m->breakPoints && BreakARMCheck(m->breakPoints, memAddr & m->mask)) {
@ -2914,7 +2918,7 @@ int armExecute()
count(opcode, cond_res); count(opcode, cond_res);
#endif #endif
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (enableRegBreak) { if (enableRegBreak) {
if (lowRegBreakCounter[0]) if (lowRegBreakCounter[0])
breakReg_check(0); breakReg_check(0);

View File

@ -1,4 +1,4 @@
#include "armdis.h" #include "core/gba/gbaCpuArmDis.h"
/************************************************************************/ /************************************************************************/
/* Arm/Thumb command set disassembler */ /* Arm/Thumb command set disassembler */
@ -6,9 +6,8 @@
#include <cstring> #include <cstring>
#include "core/base/port.h" #include "core/base/port.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "armdis.h" #include "core/gba/gbaElf.h"
#include "elf.h"
struct Opcodes { struct Opcodes {
uint32_t mask; uint32_t mask;

View File

@ -2,8 +2,8 @@
/* Arm/Thumb command set disassembler */ /* Arm/Thumb command set disassembler */
/************************************************************************/ /************************************************************************/
#ifndef __ARMDIS_H__ #ifndef VBAM_CORE_GBA_GBACPUARMDIS_H_
#define __ARMDIS_H__ #define VBAM_CORE_GBA_GBACPUARMDIS_H_
#include <cstdint> #include <cstdint>
@ -13,4 +13,4 @@
int disThumb(uint32_t offset, char* dest, unsigned dest_sz, int flags); int disThumb(uint32_t offset, char* dest, unsigned dest_sz, int flags);
int disArm(uint32_t offset, char* dest, unsigned dest_sz, int flags); int disArm(uint32_t offset, char* dest, unsigned dest_sz, int flags);
#endif // __ARMDIS_H__ #endif // VBAM_CORE_GBA_GBACPUARMDIS_H_

View File

@ -6,11 +6,14 @@
#include <strings.h> #include <strings.h>
#endif #endif
#include "GBA.h" #include "core/gba/gba.h"
#include "GBAcpu.h" #include "core/gba/gbaCpu.h"
#include "GBAinline.h" #include "core/gba/gbaInline.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
#include "remote.h"
#if defined(VBAM_ENABLE_DEBUGGER)
#include "core/gba/gbaRemote.h"
#endif // defined(VBAM_ENABLE_DEBUGGER)
#ifdef PROFILING #ifdef PROFILING
#include "prof/prof.h" #include "prof/prof.h"
@ -33,7 +36,7 @@ static INSN_REGPARM void thumbUnknownInsn(uint32_t opcode)
CPUUndefinedException(); CPUUndefinedException();
} }
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
static INSN_REGPARM void thumbBreakpoint(uint32_t opcode) static INSN_REGPARM void thumbBreakpoint(uint32_t opcode)
{ {
reg[15].I -= 2; reg[15].I -= 2;
@ -45,7 +48,7 @@ static INSN_REGPARM void thumbBreakpoint(uint32_t opcode)
// Common macros ////////////////////////////////////////////////////////// // Common macros //////////////////////////////////////////////////////////
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
#define THUMB_CONSOLE_OUTPUT(a, b) \ #define THUMB_CONSOLE_OUTPUT(a, b) \
do { \ do { \
if ((opcode == 0x4000) && (reg[0].I == 0xC0DED00D)) { \ if ((opcode == 0x4000) && (reg[0].I == 0xC0DED00D)) { \
@ -1853,7 +1856,7 @@ static INSN_REGPARM void thumbF8(uint32_t opcode)
typedef INSN_REGPARM void (*insnfunc_t)(uint32_t opcode); typedef INSN_REGPARM void (*insnfunc_t)(uint32_t opcode);
#define thumbUI thumbUnknownInsn #define thumbUI thumbUnknownInsn
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
#define thumbBP thumbBreakpoint #define thumbBP thumbBreakpoint
#else #else
#define thumbBP thumbUnknownInsn #define thumbBP thumbUnknownInsn
@ -2021,7 +2024,7 @@ int thumbExecute()
reg[15].I += 2; reg[15].I += 2;
THUMB_PREFETCH_NEXT; THUMB_PREFETCH_NEXT;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
uint32_t memAddr = armNextPC; uint32_t memAddr = armNextPC;
memoryMap* m = &map[memAddr >> 24]; memoryMap* m = &map[memAddr >> 24];
if (m->breakPoints && BreakThumbCheck(m->breakPoints, memAddr & m->mask)) { if (m->breakPoints && BreakThumbCheck(m->breakPoints, memAddr & m->mask)) {
@ -2035,7 +2038,7 @@ int thumbExecute()
(*thumbInsnTable[opcode >> 6])(opcode); (*thumbInsnTable[opcode >> 6])(opcode);
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (enableRegBreak) { if (enableRegBreak) {
if (lowRegBreakCounter[0]) if (lowRegBreakCounter[0])
breakReg_check(0); breakReg_check(0);

View File

@ -1,9 +1,9 @@
#include "EEprom.h" #include "core/gba/gbaEeprom.h"
#include <cstring> #include <cstring>
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "GBA.h" #include "core/gba/gba.h"
extern int cpuDmaCount; extern int cpuDmaCount;

View File

@ -1,5 +1,5 @@
#ifndef EEPROM_H #ifndef VBAM_CORE_GBA_GBAEEPROM_H_
#define EEPROM_H #define VBAM_CORE_GBA_GBAEEPROM_H_
#include <cstdint> #include <cstdint>
@ -29,4 +29,4 @@ extern int eepromSize;
#define EEPROM_READDATA2 3 #define EEPROM_READDATA2 3
#define EEPROM_WRITEDATA 4 #define EEPROM_WRITEDATA 4
#endif // EEPROM_H #endif // VBAM_CORE_GBA_GBAEEPROM_H_

View File

@ -1,11 +1,13 @@
#include "core/gba/gbaElf.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "core/base/message.h" #include "core/base/message.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "elf.h" #include "core/gba/gbaGlobals.h"
#define elfReadMemory(addr) \ #define elfReadMemory(addr) \
READ32LE((&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask])) READ32LE((&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask]))

View File

@ -1,5 +1,5 @@
#ifndef ELF_H #ifndef VBAM_CORE_GBA_GBAELF_H_
#define ELF_H #define VBAM_CORE_GBA_GBAELF_H_
#include <cstdint> #include <cstdint>
#include <cstdio> #include <cstdio>
@ -263,4 +263,4 @@ uint32_t elfDecodeLocation(Function*, ELFBlock*, LocationType*);
uint32_t elfDecodeLocation(Function*, ELFBlock*, LocationType*, uint32_t); uint32_t elfDecodeLocation(Function*, ELFBlock*, LocationType*, uint32_t);
int elfFindLine(CompileUnit* unit, Function* func, uint32_t addr, const char**); int elfFindLine(CompileUnit* unit, Function* func, uint32_t addr, const char**);
#endif // ELF_H #endif // VBAM_CORE_GBA_GBAELF_H_

View File

@ -1,6 +1,4 @@
#include "gbafilter.h" #include "core/gba/gbaFilter.h"
#include <math.h>
extern int systemColorDepth; extern int systemColorDepth;
extern int systemRedShift; extern int systemRedShift;

View File

@ -1,5 +1,5 @@
#ifndef VBAM_GBA_GBAFILTER_H_ #ifndef VBAM_CORE_GBA_GBAFILTER_H_
#define VBAM_GBA_GBAFILTER_H_ #define VBAM_CORE_GBA_GBAFILTER_H_
#include <cstdint> #include <cstdint>
@ -7,4 +7,4 @@ void gbafilter_pal(uint16_t* buf, int count);
void gbafilter_pal32(uint32_t* buf, int count); void gbafilter_pal32(uint32_t* buf, int count);
void gbafilter_pad(uint8_t* buf, int count); void gbafilter_pad(uint8_t* buf, int count);
#endif // VBAM_GBA_GBAFILTER_H_ #endif // VBAM_CORE_GBA_GBAFILTER_H_

View File

@ -1,12 +1,11 @@
#include "Flash.h" #include "core/gba/gbaFlash.h"
#include <memory.h> #include <cstdio>
#include <stdio.h> #include <cstring>
#include <string.h>
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "Sram.h" #include "core/gba/internal/gbaSram.h"
#define FLASH_READ_ARRAY 0 #define FLASH_READ_ARRAY 0
#define FLASH_CMD_1 1 #define FLASH_CMD_1 1

View File

@ -1,5 +1,5 @@
#ifndef FLASH_H #ifndef VBAM_CORE_GBA_GBAFLASH_H_
#define FLASH_H #define VBAM_CORE_GBA_GBAFLASH_H_
#include <cstdint> #include <cstdint>
@ -28,4 +28,4 @@ extern void flashInit();
extern int g_flashSize; extern int g_flashSize;
#endif // FLASH_H #endif // VBAM_CORE_GBA_GBAFLASH_H_

View File

@ -1,4 +1,4 @@
#include "GBAGfx.h" #include "core/gba/gbaGfx.h"
#if defined(TILED_RENDERING) #if defined(TILED_RENDERING)
#include <cstring> #include <cstring>

View File

@ -1,9 +1,11 @@
#ifndef GFX_H #ifndef VBAM_CORE_GBA_GBAGFX_H_
#define GFX_H #define VBAM_CORE_GBA_GBAGFX_H_
#include <cstdint>
#include <cstddef>
#include "core/base/port.h" #include "core/base/port.h"
#include "GBA.h" #include "core/gba/gbaGlobals.h"
#include "Globals.h"
//#define SPRITE_DEBUG //#define SPRITE_DEBUG
@ -1599,4 +1601,4 @@ static inline void gfxAlphaBlend(uint32_t* ta, uint32_t* tb, int ca, int cb)
} }
} }
#endif // GFX_H #endif // VBAM_CORE_GBA_GBAGFX_H_

View File

@ -1,6 +1,6 @@
#include "GBA.h" #include "core/gba/gbaGlobals.h"
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
int oldreg[18]; int oldreg[18];
char oldbuffer[10]; char oldbuffer[10];
#endif #endif
@ -17,6 +17,9 @@ bool armIrqEnable = true;
uint32_t armNextPC = 0x00000000; uint32_t armNextPC = 0x00000000;
int armMode = 0x1f; int armMode = 0x1f;
uint32_t stop = 0x08000568; uint32_t stop = 0x08000568;
// Joybus
bool gba_joybus_enabled = false;
bool gba_joybus_active = false;
// this is an optional hack to change the backdrop/background color: // this is an optional hack to change the backdrop/background color:
// -1: disabled // -1: disabled

View File

@ -1,7 +1,7 @@
#ifndef GLOBALS_H #ifndef VBAM_CORE_GBA_GBAGLOBALS_H_
#define GLOBALS_H #define VBAM_CORE_GBA_GBAGLOBALS_H_
#include "GBA.h" #include "core/gba/gba.h"
#define VERBOSE_SWI 1 #define VERBOSE_SWI 1
#define VERBOSE_UNALIGNED_MEMORY 2 #define VERBOSE_UNALIGNED_MEMORY 2
@ -118,4 +118,4 @@ extern uint16_t IE;
extern uint16_t IF; extern uint16_t IF;
extern uint16_t IME; extern uint16_t IME;
#endif // GLOBALS_H #endif // VBAM_CORE_GBA_GBAGLOBALS_H_

View File

@ -1,17 +1,21 @@
#ifndef GBAINLINE_H #ifndef VBAM_CORE_GBA_GBAINLINE_H_
#define GBAINLINE_H #define VBAM_CORE_GBA_GBAINLINE_H_
#include <cstdint>
#include <type_traits> #include <type_traits>
#include "core/base/system.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "GBALink.h" #include "core/base/system.h"
#include "GBAcpu.h" #include "core/gba/gbaCpu.h"
#include "RTC.h" #include "core/gba/gbaEeprom.h"
#include "Sound.h" #include "core/gba/gbaFlash.h"
#include "agbprint.h" #include "core/gba/gbaPrint.h"
#include "remote.h" #include "core/gba/gbaRtc.h"
#include "stdint.h" #include "core/gba/gbaSound.h"
#if defined(VBAM_ENABLE_DEBUGGER)
#include "core/gba/gbaRemote.h"
#endif // defined(VBAM_ENABLE_DEBUGGER)
extern const uint32_t objTilesAddress[3]; extern const uint32_t objTilesAddress[3];
@ -74,7 +78,7 @@ extern uint32_t myROM[];
static inline uint32_t CPUReadMemory(uint32_t address) static inline uint32_t CPUReadMemory(uint32_t address)
{ {
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24]; memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) { if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnRead(address, 2)) { if (debuggerBreakOnRead(address, 2)) {
@ -215,7 +219,7 @@ static inline uint32_t CPUReadMemory(uint32_t address)
static inline uint32_t CPUReadHalfWord(uint32_t address) static inline uint32_t CPUReadHalfWord(uint32_t address)
{ {
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24]; memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) { if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnRead(address, 1)) { if (debuggerBreakOnRead(address, 1)) {
@ -362,7 +366,7 @@ static inline int16_t CPUReadHalfWordSigned(uint32_t address)
static inline uint8_t CPUReadByte(uint32_t address) static inline uint8_t CPUReadByte(uint32_t address)
{ {
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24]; memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) { if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnRead(address, 0)) { if (debuggerBreakOnRead(address, 0)) {
@ -467,7 +471,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
} }
#endif #endif
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24]; memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) { if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnWrite(address, value, 1)) { if (debuggerBreakOnWrite(address, value, 1)) {
@ -478,7 +482,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
switch (address >> 24) { switch (address >> 24) {
case 0x02: case 0x02:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeWorkRAM[address & 0x3FFFC])) if (*((uint32_t*)&freezeWorkRAM[address & 0x3FFFC]))
cheatsWriteMemory(address & 0x203FFFC, value); cheatsWriteMemory(address & 0x203FFFC, value);
else else
@ -486,7 +490,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
WRITE32LE(((uint32_t*)&g_workRAM[address & 0x3FFFC]), value); WRITE32LE(((uint32_t*)&g_workRAM[address & 0x3FFFC]), value);
break; break;
case 0x03: case 0x03:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeInternalRAM[address & 0x7ffc])) if (*((uint32_t*)&freezeInternalRAM[address & 0x7ffc]))
cheatsWriteMemory(address & 0x3007FFC, value); cheatsWriteMemory(address & 0x3007FFC, value);
else else
@ -501,7 +505,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
goto unwritable; goto unwritable;
break; break;
case 0x05: case 0x05:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezePRAM[address & 0x3fc])) if (*((uint32_t*)&freezePRAM[address & 0x3fc]))
cheatsWriteMemory(address & 0x70003FC, value); cheatsWriteMemory(address & 0x70003FC, value);
else else
@ -515,7 +519,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
if ((address & 0x18000) == 0x18000) if ((address & 0x18000) == 0x18000)
address &= 0x17fff; address &= 0x17fff;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeVRAM[address])) if (*((uint32_t*)&freezeVRAM[address]))
cheatsWriteMemory(address + 0x06000000, value); cheatsWriteMemory(address + 0x06000000, value);
else else
@ -524,7 +528,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
WRITE32LE(((uint32_t*)&g_vram[address]), value); WRITE32LE(((uint32_t*)&g_vram[address]), value);
break; break;
case 0x07: case 0x07:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeOAM[address & 0x3fc])) if (*((uint32_t*)&freezeOAM[address & 0x3fc]))
cheatsWriteMemory(address & 0x70003FC, value); cheatsWriteMemory(address & 0x70003FC, value);
else else
@ -572,7 +576,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
} }
#endif #endif
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24]; memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) { if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnWrite(address, value, 1)) { if (debuggerBreakOnWrite(address, value, 1)) {
@ -583,7 +587,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
switch (address >> 24) { switch (address >> 24) {
case 2: case 2:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeWorkRAM[address & 0x3FFFE])) if (*((uint16_t*)&freezeWorkRAM[address & 0x3FFFE]))
cheatsWriteHalfWord(address & 0x203FFFE, value); cheatsWriteHalfWord(address & 0x203FFFE, value);
else else
@ -591,7 +595,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
WRITE16LE(((uint16_t*)&g_workRAM[address & 0x3FFFE]), value); WRITE16LE(((uint16_t*)&g_workRAM[address & 0x3FFFE]), value);
break; break;
case 3: case 3:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeInternalRAM[address & 0x7ffe])) if (*((uint16_t*)&freezeInternalRAM[address & 0x7ffe]))
cheatsWriteHalfWord(address & 0x3007ffe, value); cheatsWriteHalfWord(address & 0x3007ffe, value);
else else
@ -605,7 +609,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
goto unwritable; goto unwritable;
break; break;
case 5: case 5:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezePRAM[address & 0x03fe])) if (*((uint16_t*)&freezePRAM[address & 0x03fe]))
cheatsWriteHalfWord(address & 0x70003fe, value); cheatsWriteHalfWord(address & 0x70003fe, value);
else else
@ -618,7 +622,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
return; return;
if ((address & 0x18000) == 0x18000) if ((address & 0x18000) == 0x18000)
address &= 0x17fff; address &= 0x17fff;
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeVRAM[address])) if (*((uint16_t*)&freezeVRAM[address]))
cheatsWriteHalfWord(address + 0x06000000, value); cheatsWriteHalfWord(address + 0x06000000, value);
else else
@ -626,7 +630,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
WRITE16LE(((uint16_t*)&g_vram[address]), value); WRITE16LE(((uint16_t*)&g_vram[address]), value);
break; break;
case 7: case 7:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeOAM[address & 0x03fe])) if (*((uint16_t*)&freezeOAM[address & 0x03fe]))
cheatsWriteHalfWord(address & 0x70003fe, value); cheatsWriteHalfWord(address & 0x70003fe, value);
else else
@ -670,7 +674,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
static inline void CPUWriteByte(uint32_t address, uint8_t b) static inline void CPUWriteByte(uint32_t address, uint8_t b)
{ {
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24]; memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) { if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnWrite(address, b, 1)) { if (debuggerBreakOnWrite(address, b, 1)) {
@ -681,7 +685,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
switch (address >> 24) { switch (address >> 24) {
case 2: case 2:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (freezeWorkRAM[address & 0x3FFFF]) if (freezeWorkRAM[address & 0x3FFFF])
cheatsWriteByte(address & 0x203FFFF, b); cheatsWriteByte(address & 0x203FFFF, b);
else else
@ -689,7 +693,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
g_workRAM[address & 0x3FFFF] = b; g_workRAM[address & 0x3FFFF] = b;
break; break;
case 3: case 3:
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (freezeInternalRAM[address & 0x7fff]) if (freezeInternalRAM[address & 0x7fff])
cheatsWriteByte(address & 0x3007fff, b); cheatsWriteByte(address & 0x3007fff, b);
else else
@ -776,7 +780,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
// no need to switch // no need to switch
// byte writes to OBJ VRAM are ignored // byte writes to OBJ VRAM are ignored
if ((address) < objTilesAddress[((DISPCNT & 7) + 1) >> 2]) { if ((address) < objTilesAddress[((DISPCNT & 7) + 1) >> 2]) {
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
if (freezeVRAM[address]) if (freezeVRAM[address])
cheatsWriteByte(address + 0x06000000, b); cheatsWriteByte(address + 0x06000000, b);
else else
@ -819,4 +823,4 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
} }
} }
#endif // GBAINLINE_H #endif // VBAM_CORE_GBA_GBAINLINE_H_

View File

@ -1,16 +1,46 @@
#include "core/gba/gbaLink.h"
// This file was written by denopqrihg // This file was written by denopqrihg
// with major changes by tjm // with major changes by tjm
#if defined(NO_LINK)
#error "This file should not be compiled with NO_LINK."
#endif // defined(NO_LINK)
#if defined(_WIN32)
#include <Windows.h>
#else // !defined(_WIN32)
#include <errno.h>
#include <fcntl.h>
#include <semaphore.h>
#include <sys/mman.h>
#include <time.h>
#endif // defined(_WIN32)
#include <cstdio> #include <cstdio>
#include <cstdlib>
#include <cstring> #include <cstring>
#include <string> #include <string>
// malloc.h does not seem to exist on Mac OS 10.7 and is an error on FreeBSD #include <SFML/Network.hpp>
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
#include <stdlib.h> #ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) gettext(x)
#else #else
#include <malloc.h> #define _(x) x
#endif #endif
#include "core/base/message.h"
#include "core/base/port.h"
#include "core/gba/gba.h"
#include "core/gba/gbaCpu.h"
#include "core/gba/internal/gbaSockClient.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
@ -33,8 +63,6 @@ const char* MakeInstanceFilename(const char* Input)
return result; return result;
} }
#ifndef NO_LINK
enum { enum {
SENDING = 0, SENDING = 0,
RECEIVING = 1 RECEIVING = 1
@ -50,10 +78,6 @@ enum siocnt_lo_32bit {
SIO_IRQ_ENABLE = 0x4000 SIO_IRQ_ENABLE = 0x4000
}; };
// Joybus
bool gba_joybus_enabled = false;
bool gba_joybus_active = false;
// If disabled, gba core won't call any (non-joybus) link functions // If disabled, gba core won't call any (non-joybus) link functions
bool gba_link_enabled = false; bool gba_link_enabled = false;
@ -67,29 +91,7 @@ uint16_t IP_LINK_PORT = 5738;
std::string IP_LINK_BIND_ADDRESS = "*"; std::string IP_LINK_BIND_ADDRESS = "*";
#include "core/base/message.h" #if !defined(_WIN32)
#include "core/base/port.h"
#include "GBA.h"
#include "GBALink.h"
#include "GBASockClient.h"
#include <SFML/Network.hpp>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) gettext(x)
#else
#define _(x) x
#endif
#if (defined __WIN32__ || defined _WIN32)
#include <windows.h>
#else
#include <errno.h>
#include <fcntl.h>
#include <semaphore.h>
#include <sys/mman.h>
#include <time.h>
#define ReleaseSemaphore(sem, nrel, orel) \ #define ReleaseSemaphore(sem, nrel, orel) \
do { \ do { \
@ -97,7 +99,9 @@ std::string IP_LINK_BIND_ADDRESS = "*";
sem_post(sem); \ sem_post(sem); \
} while (0) } while (0)
#define WAIT_TIMEOUT -1 #define WAIT_TIMEOUT -1
#ifdef HAVE_SEM_TIMEDWAIT #ifdef HAVE_SEM_TIMEDWAIT
int WaitForSingleObject(sem_t* s, int t) int WaitForSingleObject(sem_t* s, int t)
{ {
struct timespec ts; struct timespec ts;
@ -334,7 +338,7 @@ bool EmuReseted = true;
bool LinkIsWaiting = false; bool LinkIsWaiting = false;
bool LinkFirstTime = true; bool LinkFirstTime = true;
#if (defined __WIN32__ || defined _WIN32) #if (defined _WIN32)
static ConnectionState InitIPC(); static ConnectionState InitIPC();
static void StartCableIPC(uint16_t siocnt); static void StartCableIPC(uint16_t siocnt);
@ -4136,7 +4140,3 @@ static void CloseIPC()
} }
#endif #endif
#else
bool gba_joybus_active = false;
#endif

View File

@ -1,9 +1,13 @@
#ifndef GBA_GBALINK_H #ifndef VBAM_CORE_GBA_GBALINK_H_
#define GBA_GBALINK_H #define VBAM_CORE_GBA_GBALINK_H_
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#if defined(NO_LINK)
#error "This file should not be included with NO_LINK."
#endif // defined(NO_LINK)
extern uint16_t IP_LINK_PORT; extern uint16_t IP_LINK_PORT;
extern std::string IP_LINK_BIND_ADDRESS; extern std::string IP_LINK_BIND_ADDRESS;
@ -143,28 +147,6 @@ extern void CleanLocalLink();
extern const char* MakeInstanceFilename(const char* Input); extern const char* MakeInstanceFilename(const char* Input);
// register definitions
#define COMM_SIODATA32_L 0x120 // Lower 16bit on Normal mode
#define COMM_SIODATA32_H 0x122 // Higher 16bit on Normal mode
#define COMM_SIOCNT 0x128
#define COMM_SIODATA8 0x12a // 8bit on Normal/UART mode, (up to 4x8bit with FIFO)
#define COMM_SIOMLT_SEND 0x12a // SIOMLT_SEND (16bit R/W) on MultiPlayer mode (local outgoing)
#define COMM_SIOMULTI0 0x120 // SIOMULTI0 (16bit) on MultiPlayer mode (Parent/Master)
#define COMM_SIOMULTI1 0x122 // SIOMULTI1 (16bit) on MultiPlayer mode (Child1/Slave1)
#define COMM_SIOMULTI2 0x124 // SIOMULTI2 (16bit) on MultiPlayer mode (Child2/Slave2)
#define COMM_SIOMULTI3 0x126 // SIOMULTI3 (16bit) on MultiPlayer mode (Child3/Slave3)
#define COMM_RCNT 0x134 // SIO Mode (4bit data) on GeneralPurpose mode
#define COMM_IR 0x136 // Infrared Register (16bit) 1bit data at a time(LED On/Off)?
#define COMM_JOYCNT 0x140
#define COMM_JOY_RECV_L 0x150 // Send/Receive 8bit Lower first then 8bit Higher
#define COMM_JOY_RECV_H 0x152
#define COMM_JOY_TRANS_L 0x154 // Send/Receive 8bit Lower first then 8bit Higher
#define COMM_JOY_TRANS_H 0x156
#define COMM_JOYSTAT 0x158 // Send/Receive 8bit lower only
#define JOYSTAT_RECV 2
#define JOYSTAT_SEND 8
#define JOYCNT_RESET 1 #define JOYCNT_RESET 1
#define JOYCNT_RECV_COMPLETE 2 #define JOYCNT_RECV_COMPLETE 2
#define JOYCNT_SEND_COMPLETE 4 #define JOYCNT_SEND_COMPLETE 4
@ -211,4 +193,4 @@ extern uint16_t gbLinkUpdateIPC(uint8_t b, int gbSerialOn);
extern void BootLink(int m_type, const char* host, int timeout, bool m_hacks, int m_numplayers); extern void BootLink(int m_type, const char* host, int timeout, bool m_hacks, int m_numplayers);
#endif /* GBA_GBALINK_H */ #endif // VBAM_CORE_GBA_GBALINK_H_

View File

@ -1,6 +1,6 @@
#include "GBA.h" #include "core/gba/gbaGfx.h"
#include "GBAGfx.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
void mode0RenderLine() void mode0RenderLine()
{ {

View File

@ -1,6 +1,6 @@
#include "GBA.h" #include "core/gba/gbaGfx.h"
#include "GBAGfx.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
void mode1RenderLine() void mode1RenderLine()
{ {

View File

@ -1,6 +1,5 @@
#include "GBA.h" #include "core/gba/gbaGfx.h"
#include "GBAGfx.h" #include "core/gba/gbaGlobals.h"
#include "Globals.h"
void mode2RenderLine() void mode2RenderLine()
{ {

View File

@ -1,6 +1,6 @@
#include "GBA.h" #include "core/gba/gbaGfx.h"
#include "GBAGfx.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
void mode3RenderLine() void mode3RenderLine()
{ {

View File

@ -1,6 +1,6 @@
#include "GBA.h" #include "core/gba/gbaGfx.h"
#include "GBAGfx.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
void mode4RenderLine() void mode4RenderLine()
{ {

View File

@ -1,6 +1,6 @@
#include "GBA.h" #include "core/gba/gbaGfx.h"
#include "GBAGfx.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
void mode5RenderLine() void mode5RenderLine()
{ {

View File

@ -1,8 +1,7 @@
#include "agbprint.h" #include "core/gba/gbaPrint.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "GBA.h" #include "core/gba/gbaGlobals.h"
#include "Globals.h"
#define debuggerWriteHalfWord(addr, value) \ #define debuggerWriteHalfWord(addr, value) \
WRITE16LE((uint16_t*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask], (value)) WRITE16LE((uint16_t*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask], (value))
@ -54,7 +53,7 @@ void agbPrintFlush()
uint32_t address = (debuggerReadHalfWord(0x9fe20fa) << 16); uint32_t address = (debuggerReadHalfWord(0x9fe20fa) << 16);
if (address != 0xfd0000 && address != 0x1fd0000) { if (address != 0xfd0000 && address != 0x1fd0000) {
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
dbgOutput("Did you forget to call AGBPrintInit?\n", 0); dbgOutput("Did you forget to call AGBPrintInit?\n", 0);
#endif #endif
// get rid of the text otherwise we will continue to be called // get rid of the text otherwise we will continue to be called
@ -66,7 +65,7 @@ void agbPrintFlush()
while (get != put) { while (get != put) {
char c = data[get++]; char c = data[get++];
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
char s[2]; char s[2];
s[0] = c; s[0] = c;
s[1] = 0; s[1] = 0;

View File

@ -1,5 +1,5 @@
#ifndef AGBPRINT_H #ifndef VBAM_CORE_GBA_GBAPRINT_H_
#define AGBPRINT_H #define VBAM_CORE_GBA_GBAPRINT_H_
#include <cstdint> #include <cstdint>
@ -9,4 +9,4 @@ void agbPrintReset();
bool agbPrintWrite(uint32_t address, uint16_t value); bool agbPrintWrite(uint32_t address, uint16_t value);
void agbPrintFlush(); void agbPrintFlush();
#endif // AGBPRINT_H #endif // VBAM_CORE_GBA_GBAPRINT_H_

View File

@ -1,26 +1,11 @@
#ifndef __LIBRETRO__ #include "core/gba/gbaRemote.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iosfwd> #if !defined(VBAM_ENABLE_DEBUGGER)
#include <sstream> #error "This file should only be compiled when VBAM_ENABLE_DEBUGGER is defined."
#include <vector> #endif // !defined(VBAM_ENABLE_DEBUGGER)
#if defined(_WIN32)
#ifndef _WIN32
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif // HAVE_NETINET_IN_H
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#else // ! HAVE_ARPA_INET_H
#define socklen_t int
#endif // ! HAVE_ARPA_INET_H
#define SOCKET int
#else // _WIN32
#include <io.h> #include <io.h>
#include <winsock.h> #include <winsock.h>
#define socklen_t int #define socklen_t int
@ -28,16 +13,41 @@
#define read _read #define read _read
#define write _write #define write _write
#define strdup _strdup #define strdup _strdup
#endif // _WIN32
#include "BreakpointStructures.h" #else // !defined(_WIN32)
#include "GBA.h"
#include "elf.h" #include <netdb.h>
#include "remote.h" #include <sys/socket.h>
#include <unistd.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif // HAVE_NETINET_IN_H
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#else // ! HAVE_ARPA_INET_H
#define socklen_t int
#endif // ! HAVE_ARPA_INET_H
#define SOCKET int
#endif // defined(_WIN32)
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip> #include <iomanip>
#include <iosfwd>
#include <iostream> #include <iostream>
#include <sstream>
#include "core/gba/gba.h"
#include "core/gba/gbaElf.h"
#include "core/gba/gbaGlobals.h"
#include "core/gba/gbaRemote.h"
#include "core/gba/internal/gbaBreakpoint.h"
extern bool debugger;
extern int emulating; extern int emulating;
extern void CPUUpdateCPSR(); extern void CPUUpdateCPSR();
@ -3954,7 +3964,7 @@ void remoteWriteWatch(char* p, bool active)
// return; // return;
//} //}
#ifdef BKPT_SUPPORT #ifdef VBAM_ENABLE_DEBUGGER
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if ((address >> 24) == 2) if ((address >> 24) == 2)
freezeWorkRAM[address & 0x3ffff] = active; freezeWorkRAM[address & 0x3ffff] = active;
@ -4296,5 +4306,3 @@ void monprintf(std::string line)
remotePutPacket(dbgReply); remotePutPacket(dbgReply);
} }
} }
#endif

View File

@ -1,7 +1,11 @@
#ifndef REMOTE_H #ifndef VBAM_CORE_GBA_GBAREMOTE_H_
#define REMOTE_H #define VBAM_CORE_GBA_GBAREMOTE_H_
#include "GBA.h" #if !defined(VBAM_ENABLE_DEBUGGER)
#error "This file should only be included when VBAM_ENABLE_DEBUGGER is defined."
#endif // !defined(VBAM_ENABLE_DEBUGGER)
#include <cstdint>
#define BitSet(array, bit) ((uint8_t*)(array))[(bit) >> 3] |= (1 << ((bit)&7)) #define BitSet(array, bit) ((uint8_t*)(array))[(bit) >> 3] |= (1 << ((bit)&7))
@ -27,8 +31,6 @@
#define BreakCheck(array, addr, flag) \ #define BreakCheck(array, addr, flag) \
((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf)) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf))
extern bool debugger;
extern bool dexp_eval(char*, uint32_t*); extern bool dexp_eval(char*, uint32_t*);
extern void dexp_setVar(char*, uint32_t); extern void dexp_setVar(char*, uint32_t);
extern void dexp_listVars(); extern void dexp_listVars();
@ -76,4 +78,4 @@ void remoteOutput(const char* s, uint32_t addr);
void remoteSetProtocol(int p); void remoteSetProtocol(int p);
void remoteSetPort(int port); void remoteSetPort(int port);
#endif // REMOTE_H #endif // VBAM_CORE_GBA_GBAREMOTE_H_

View File

@ -1,4 +1,4 @@
#include "RTC.h" #include "core/gba/gbaRtc.h"
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
@ -6,9 +6,8 @@
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "core/base/message.h" #include "core/base/message.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "GBAinline.h" #include "core/gba/gbaInline.h"
#include "Globals.h"
enum RTCSTATE { enum RTCSTATE {

View File

@ -1,5 +1,5 @@
#ifndef RTC_H #ifndef VBAM_CORE_GBA_GBARTC_H_
#define RTC_H #define VBAM_CORE_GBA_GBARTC_H_
#include <cstdint> #include <cstdint>
@ -23,4 +23,4 @@ void rtcReadGame(gzFile gzFile);
void rtcSaveGame(gzFile gzFile); void rtcSaveGame(gzFile gzFile);
#endif // defined(__LIBRETRO__) #endif // defined(__LIBRETRO__)
#endif // RTC_H #endif // VBAM_CORE_GBA_GBARTC_H_

View File

@ -1,16 +1,16 @@
#include "Sound.h" #include "core/gba/gbaSound.h"
#include <array> #include <array>
#include <cstring> #include <cstring>
#include "core/apu/Gb_Apu.h"
#include "core/apu/Multi_Buffer.h"
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "core/base/port.h" #include "core/base/port.h"
#include "core/base/sound_driver.h" #include "core/base/sound_driver.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
#include "../apu/Gb_Apu.h"
#include "../apu/Multi_Buffer.h"
#define NR10 0x60 #define NR10 0x60
#define NR11 0x62 #define NR11 0x62

View File

@ -1,5 +1,5 @@
#ifndef SOUND_H #ifndef VBAM_CORE_GBA_GBASOUND_H_
#define SOUND_H #define VBAM_CORE_GBA_GBASOUND_H_
#include <cstdint> #include <cstdint>
@ -92,4 +92,4 @@ class Multi_Buffer;
void flush_samples(Multi_Buffer* buffer); void flush_samples(Multi_Buffer* buffer);
#endif // SOUND_H #endif // VBAM_CORE_GBA_GBASOUND_H_

View File

@ -1,11 +1,12 @@
#include <math.h> #include "core/gba/internal/gbaBios.h"
#include <memory.h>
#include <stdlib.h>
#include "GBA.h" #include <cmath>
#include "GBAinline.h" #include <cstdlib>
#include "Globals.h" #include <cstring>
#include "bios.h"
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#include "core/gba/gbaInline.h"
int16_t sineTable[256] = { int16_t sineTable[256] = {
(int16_t)0x0000u, (int16_t)0x0192u, (int16_t)0x0323u, (int16_t)0x04B5u, (int16_t)0x0645u, (int16_t)0x07D5u, (int16_t)0x0964u, (int16_t)0x0AF1u, (int16_t)0x0000u, (int16_t)0x0192u, (int16_t)0x0323u, (int16_t)0x04B5u, (int16_t)0x0645u, (int16_t)0x07D5u, (int16_t)0x0964u, (int16_t)0x0AF1u,

View File

@ -1,5 +1,7 @@
#ifndef BIOS_H #ifndef VBAM_CORE_GBA_INTERNAL_GBABIOS_H_
#define BIOS_H #define VBAM_CORE_GBA_INTERNAL_GBABIOS_H_
#include <cstdint>
extern void BIOS_ArcTan(); extern void BIOS_ArcTan();
extern void BIOS_ArcTan2(); extern void BIOS_ArcTan2();
@ -33,4 +35,4 @@ extern void BIOS_SndDriverVSyncOff();
extern void BIOS_SndDriverVSyncOn(); extern void BIOS_SndDriverVSyncOn();
extern void BIOS_SndChannelClear(); extern void BIOS_SndChannelClear();
#endif // BIOS_H #endif // VBAM_CORE_GBA_INTERNAL_GBABIOS_H_

View File

@ -94,14 +94,19 @@ sh, shw, shalfword, int16_t short --> signed halfword
w, word, uint2_t --> word w, word, uint2_t --> word
sw, sword, int32_t, int --> signed word sw, sword, int32_t, int --> signed word
*/ */
#include "core/gba/internal/gbaBreakpoint.h"
#include <ctype.h> #if !defined(VBAM_ENABLE_DEBUGGER)
#include <stdio.h> #error "This file should only be compiled when VBAM_ENABLE_DEBUGGER is defined."
#include <stdlib.h> #endif // !defined(VBAM_ENABLE_DEBUGGER)
#include <string.h>
#include "BreakpointStructures.h" #include <cctype>
#include "remote.h" #include <cstdio>
#include <cstdlib>
#include <cstring>
#include "core/gba/gba.h"
#include "core/gba/gbaRemote.h"
#if (defined __WIN32__ || defined _WIN32) #if (defined __WIN32__ || defined _WIN32)
#define strdup _strdup #define strdup _strdup

View File

@ -1,5 +1,9 @@
#ifndef VBA_BKS_H #ifndef VBAM_CORE_GBA_INTERNAL_GBABREAKPOINT_H_
#define VBA_BKS_H #define VBAM_CORE_GBA_INTERNAL_GBABREAKPOINT_H_
#if !defined(VBAM_ENABLE_DEBUGGER)
#error "This file should only be included when VBAM_ENABLE_DEBUGGER is defined."
#endif // !defined(VBAM_ENABLE_DEBUGGER)
#include <cstdint> #include <cstdint>
@ -63,4 +67,5 @@ bool doBreak(struct ConditionalBreak* toTest);
// uint8_t printConditionalsFromAddress(uint32_t address); // uint8_t printConditionalsFromAddress(uint32_t address);
// void printAllFlagConditionals(uint8_t flag, bool orMode); // void printAllFlagConditionals(uint8_t flag, bool orMode);
// void printAllFlagConditionalsWithAddress(uint32_t address, uint8_t flag, bool orMode); // void printAllFlagConditionalsWithAddress(uint32_t address, uint8_t flag, bool orMode);
#endif
#endif // VBAM_CORE_GBA_INTERNAL_GBABREAKPOINT_H_

View File

@ -1,13 +1,13 @@
#include <locale> #include "core/gba/internal/gbaEreader.h"
#include <stdio.h>
#include <stdlib.h> #include <cstdio>
#include <string.h> #include <cstdlib>
#include <cstring>
#include "core/base/file_util.h" #include "core/base/file_util.h"
#include "GBA.h" #include "core/gba/gba.h"
#include "GBAinline.h" #include "core/gba/gbaInline.h"
#include "Globals.h" #include "core/gba/gbaGlobals.h"
#include "ereader.h"
char US_Ereader[19] = "CARDE READERPSAE01"; char US_Ereader[19] = "CARDE READERPSAE01";
char JAP_Ereader[19] = "CARDE READERPEAJ01"; char JAP_Ereader[19] = "CARDE READERPEAJ01";

View File

@ -1,9 +1,17 @@
#ifndef VBAM_CORE_GBA_INTERNAL_GBAEREADER_H_
#define VBAM_CORE_GBA_INTERNAL_GBAEREADER_H_
#include <cstdint>
extern unsigned char* DotCodeData; extern unsigned char* DotCodeData;
extern char filebuffer[]; extern char filebuffer[];
int OpenDotCodeFile(void); int OpenDotCodeFile(void);
int CheckEReaderRegion(void); int CheckEReaderRegion(void);
int LoadDotCodeData(int size, uint32_t* DCdata, unsigned long MEM1, unsigned long MEM2); int LoadDotCodeData(int size, uint32_t* DCdata, unsigned long MEM1, unsigned long MEM2);
void EReaderWriteMemory(uint32_t address, uint32_t value); void EReaderWriteMemory(uint32_t address, uint32_t value);
void BIOS_EReader_ScanCard(int swi_num); void BIOS_EReader_ScanCard(int swi_num);
#endif // VBAM_CORE_GBA_INTERNAL_GBAEREADER_H_

View File

@ -1,6 +1,8 @@
#ifndef NO_LINK #include "core/gba/internal/gbaSockClient.h"
#include "GBASockClient.h" #if defined(NO_LINK)
#error "This file should not be compiled with NO_LINK."
#endif // defined(NO_LINK)
// Currently only for Joybus communications // Currently only for Joybus communications
@ -95,4 +97,3 @@ bool GBASockClient::IsDisconnected()
{ {
return is_disconnected; return is_disconnected;
} }
#endif // NO_LINK

View File

@ -1,4 +1,9 @@
#pragma once #ifndef VBAM_CORE_GBA_INTERNAL_GBASOCKCLIENT_H_
#define VBAM_CORE_GBA_INTERNAL_GBASOCKCLIENT_H_
#if defined(NO_LINK)
#error "This file should not be included with NO_LINK."
#endif // defined(NO_LINK)
#include <cstdint> #include <cstdint>
@ -26,3 +31,5 @@ private:
int32_t clock_sync; int32_t clock_sync;
bool is_disconnected; bool is_disconnected;
}; };
#endif // VBAM_CORE_GBA_INTERNAL_GBASOCKCLIENT_H_

View File

@ -1,7 +1,7 @@
#include "Sram.h" #include "core/gba/internal/gbaSram.h"
#include "Flash.h"
#include "GBA.h" #include "core/gba/gbaFlash.h"
#include "Globals.h" #include "core/gba/gba.h"
uint8_t sramRead(uint32_t address) uint8_t sramRead(uint32_t address)
{ {

View File

@ -1,5 +1,5 @@
#ifndef SRAM_H #ifndef VBAM_CORE_GBA_INTERNAL_GBASRAM_H_
#define SRAM_H #define VBAM_CORE_GBA_INTERNAL_GBASRAM_H_
#include <cstdint> #include <cstdint>
@ -7,4 +7,4 @@ uint8_t sramRead(uint32_t address);
void sramWrite(uint32_t address, uint8_t byte); void sramWrite(uint32_t address, uint8_t byte);
void sramDelayedWrite(uint32_t address, uint8_t byte); void sramDelayedWrite(uint32_t address, uint8_t byte);
#endif // SRAM_H #endif // VBAM_CORE_GBA_INTERNAL_GBASRAM_H_

View File

@ -1,8 +0,0 @@
#ifndef GBPRINTER_H
#define GBPRINTER_H
#include <cstdint>
uint8_t gbPrinterSend(uint8_t b);
#endif // GBPRINTER_H

Some files were not shown because too many files have changed in this diff Show More