[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(
VBAMCORE_LIBS
vbamcore
vbam-core-apu
vbam-core-base
vbam-core-emulator
vbam-fex
${SDL2_TARGETS}
${SFML_LIBRARIES}
${OPENGL_LIBRARIES}
${ZLIB_LIBRARY}
)
@ -333,10 +334,8 @@ else()
endif()
# The debugger is enabled by default
if(NOT ENABLE_DEBUGGER)
add_compile_definitions(NO_DEBUGGER)
else()
add_compile_definitions(BKPT_SUPPORT)
if(ENABLE_DEBUGGER)
add_compile_definitions(VBAM_ENABLE_DEBUGGER)
endif()
# 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)
add_subdirectory(third_party/include/stb)
add_subdirectory(src/core/fex)
add_subdirectory(src/core/base)
add_subdirectory(src/core)
endif()
set(
@ -416,120 +414,6 @@ if(ENABLE_FFMPEG)
set(HDR_MAIN ${HDR_MAIN} src/common/ffmpeg.h)
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(
SRC_SDL
src/sdl/ConfigManager.cpp
@ -614,31 +498,6 @@ else()
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(
${ZLIB_INCLUDE_DIR}
third_party/include
@ -657,16 +516,8 @@ if(NOT TRANSLATIONS_ONLY)
${PROJECT_SRCS}
${SRC_MAIN}
${HDR_MAIN}
${SRC_GBA}
${HDR_GBA}
${SRC_GB}
${HDR_GB}
${SRC_APU}
${HDR_APU}
${SRC_FILTERS}
${HDR_FILTERS}
${SRC_DEBUGGER}
${HDR_DEBUGGER}
)
target_include_directories(vbamcore PUBLIC ${SDL2_INCLUDE_DIRS})
endif()

View File

@ -21,3 +21,32 @@ linkage:
short: Shared
long: Create shared libraries/DLLs
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_CONSTANT_MACROS
_CRT_SECURE_NO_WARNINGS
NOMINMAX
)
add_compile_options(
/W4

View File

@ -8,7 +8,7 @@ Known preprocessor switches:
- SDL: Defined for the SDL version
- 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.
- BKPT_SUPPORT
- VBAM_ENABLE_DEBUGGER: Enable remote debugging support
- MMX: Enable MMX instruction set
- 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)

View File

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

View File

@ -19,8 +19,8 @@
#include <iostream>
#include <SDL_events.h>
#include "SoundSDL.h"
#include "../gba/Globals.h"
#include "../gba/Sound.h"
#include "core/gba/gbaGlobals.h"
#include "core/gba/gbaSound.h"
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/
#include "Blip_Buffer.h"
#include "core/apu/Blip_Buffer.h"
#include <assert.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/
#include "Effects_Buffer.h"
#include "core/apu/Effects_Buffer.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,
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;
#define TO_FIXED( f ) fixed_t ((f) * ((fixed_t) 1 << fixed_shift))

View File

@ -6,7 +6,7 @@
#include <vector>
#include "Multi_Buffer.h"
#include "core/apu/Multi_Buffer.h"
// 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/
#include "Gb_Apu.h"
#include "core/apu/Gb_Apu.h"
/* 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
@ -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,
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 stereo_reg = 0xFF25;

View File

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

View File

@ -1,6 +1,6 @@
// Gb_Snd_Emu $vers. http://www.slack.net/~ant/
#include "Gb_Apu.h"
#include "core/apu/Gb_Apu.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,
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
#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/
#include "Gb_Apu.h"
#include "core/apu/Gb_Apu.h"
/* 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
@ -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,
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_05 = false; // enables CGB-05 zombie behavior

View File

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

View File

@ -1,6 +1,6 @@
// 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
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,
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
#include BLARGG_ENABLE_OPTIMIZER

View File

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

View File

@ -12,7 +12,7 @@
#undef 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
#define BLARGG_COMMON_H

View File

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

View File

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

View File

@ -1,7 +1,6 @@
#ifndef VBAM_GB_GB_ROM_H_
#define VBAM_GB_GB_ROM_H_
#ifndef VBAM_CORE_GB_GBCARTDATA_H_
#define VBAM_CORE_GB_GBCARTDATA_H_
#include <cassert>
#include <cstdint>
#include <string>
@ -201,4 +200,4 @@ private:
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 <cstdlib>
#include <cstring>
#include "core/base/file_util.h"
#include "core/base/message.h"
#include "core/base/system.h"
#include "core/base/file_util.h"
#include "gb.h"
#include "gbGlobals.h"
#include "core/gb/gb.h"
#include "core/gb/gbGlobals.h"
gbCheat gbCheatList[MAX_CHEATS];
int gbCheatNumber = 0;

View File

@ -1,5 +1,5 @@
#ifndef GBCHEATS_H
#define GBCHEATS_H
#ifndef VBAM_CORE_GB_GBCHEATS_H_
#define VBAM_CORE_GB_GBCHEATS_H_
#include <cstdint>
@ -48,4 +48,4 @@ extern int gbCheatNumber;
extern gbCheat gbCheatList[MAX_CHEATS];
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 "gbGlobals.h"
#include "core/gb/gbGlobals.h"
typedef struct {
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 "core/base/system.h"
#include "gbGlobals.h"
#include "gbSGB.h"
#include "core/gb/gbGlobals.h"
#include "core/gb/gbSGB.h"
uint8_t gbInvertTab[256] = {
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];

View File

@ -1,5 +1,5 @@
#ifndef GBGLOBALS_H
#define GBGLOBALS_H
#ifndef VBAM_CORE_GB_GBGLOBALS_H_
#define VBAM_CORE_GB_GBGLOBALS_H_
#include <cstdint>
@ -59,9 +59,6 @@ extern int gbBorderRowSkip;
extern int gbBorderColumnSkip;
extern int gbDmaTicks;
extern void gbRenderLine();
extern void gbDrawSprites(bool);
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 "core/base/port.h"
#include "core/base/sizes.h"
#include "core/base/system.h"
#include "gb.h"
#include "gbGlobals.h"
#include "core/gb/gb.h"
#include "core/gb/gbGlobals.h"
uint8_t gbDaysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
extern int gbGBCColorType;
extern gbRegister PC;
mapperMBC1 gbDataMBC1 = {
0, // RAM enable

View File

@ -1,5 +1,5 @@
#ifndef GBMEMORY_H
#define GBMEMORY_H
#ifndef VBAM_CORE_GB_GBMEMORY_H_
#define VBAM_CORE_GB_GBMEMORY_H_
#include <cstdint>
#include <ctime>
@ -209,4 +209,4 @@ extern void memoryUpdateMapGS3();
#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 <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 <stdlib.h>
#include "core/gb/gbSGB.h"
#include <cstdlib>
#include <cstring>
#include "core/base/file_util.h"
#include "core/base/port.h"
#include "core/base/system.h"
#include "gb.h"
#include "gbGlobals.h"
#include "core/gb/gb.h"
#include "core/gb/gbGlobals.h"
extern uint8_t* g_pix;
extern bool speedup;

View File

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

View File

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

View File

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

View File

@ -77,9 +77,10 @@
#line 1 "debugger-expr.y"
#include <stdio.h>
#include "GBA.h"
#include "core/base/port.h"
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#include <string>
#include <map>

View File

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

View File

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

View File

@ -1,5 +1,5 @@
#ifndef GBA_H
#define GBA_H
#ifndef VBAM_CORE_GBA_GBA_H_
#define VBAM_CORE_GBA_GBA_H_
#include <cstdint>
@ -58,7 +58,7 @@ enum {
typedef struct {
uint8_t* address;
uint32_t mask;
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
uint8_t* breakPoints;
uint8_t* searchMatch;
uint8_t* trace;
@ -108,8 +108,9 @@ extern bool cpuSramEnabled;
extern bool cpuFlashEnabled;
extern bool cpuEEPROMEnabled;
extern bool cpuEEPROMSensorEnabled;
extern bool debugger;
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
extern uint8_t freezeWorkRAM[0x40000];
extern uint8_t freezeInternalRAM[0x8000];
extern uint8_t freezeVRAM[0x18000];
@ -118,7 +119,6 @@ extern uint8_t freezePRAM[0x400];
extern bool debugger_last;
extern int oldreg[18];
extern char oldbuffer[10];
extern bool debugger;
#endif
extern bool CPUReadGSASnapshot(const char*);
@ -195,9 +195,26 @@ extern struct EmulatedSystem GBASystem;
#define R14_FIQ 43
#define SPSR_FIQ 44
#include "Cheats.h"
#include "EEprom.h"
#include "Flash.h"
#include "Globals.h"
// 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
#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 <stdlib.h>
#include "core/gba/gbaCheatSearch.h"
#include "CheatSearch.h"
#include <cstdlib>
#include <cstring>
CheatSearchBlock cheatSearchBlocks[4];

View File

@ -1,5 +1,5 @@
#ifndef CHEATSEARCH_H
#define CHEATSEARCH_H
#ifndef VBAM_CORE_GBA_GBACHEATSEARCH_H_
#define VBAM_CORE_GBA_GBACHEATSEARCH_H_
#include <cstdint>
@ -44,4 +44,4 @@ void cheatSearchUpdateValues(const CheatSearchData* cs);
int32_t cheatSearchSignedRead(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 <cstring>
#include "core/base/file_util.h"
#include "core/base/message.h"
#include "GBA.h"
#include "GBAinline.h"
#include "Globals.h"
#include "core/gba/gba.h"
#include "core/gba/gbaInline.h"
#include "core/gba/gbaGlobals.h"
/**
* 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);
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
static uint8_t cheatsGetType(uint32_t address)
{
switch (address >> 24) {
@ -2824,7 +2824,7 @@ static uint8_t cheatsGetType(uint32_t address)
}
#endif
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
void cheatsWriteMemory(uint32_t address, uint32_t value)
{
if (cheatsNumber == 0) {

View File

@ -1,5 +1,5 @@
#ifndef CHEATS_H
#define CHEATS_H
#ifndef VBAM_CORE_GBA_GBACHEATS_H_
#define VBAM_CORE_GBA_GBACHEATS_H_
#include <cstdint>
@ -39,7 +39,7 @@ void cheatsReadGameSkip(gzFile file, int version);
void cheatsSaveCheatList(const char* file);
bool cheatsLoadCheatList(const char* file);
#endif
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
void cheatsWriteMemory(uint32_t address, uint32_t value);
void cheatsWriteHalfWord(uint32_t address, uint16_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 CheatsData cheatsList[MAX_CHEATS];
#endif // CHEATS_H
#endif // VBAM_CORE_GBA_GBACHEATS_H_

View File

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

View File

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

View File

@ -2,8 +2,8 @@
/* Arm/Thumb command set disassembler */
/************************************************************************/
#ifndef __ARMDIS_H__
#define __ARMDIS_H__
#ifndef VBAM_CORE_GBA_GBACPUARMDIS_H_
#define VBAM_CORE_GBA_GBACPUARMDIS_H_
#include <cstdint>
@ -13,4 +13,4 @@
int disThumb(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>
#endif
#include "GBA.h"
#include "GBAcpu.h"
#include "GBAinline.h"
#include "Globals.h"
#include "remote.h"
#include "core/gba/gba.h"
#include "core/gba/gbaCpu.h"
#include "core/gba/gbaInline.h"
#include "core/gba/gbaGlobals.h"
#if defined(VBAM_ENABLE_DEBUGGER)
#include "core/gba/gbaRemote.h"
#endif // defined(VBAM_ENABLE_DEBUGGER)
#ifdef PROFILING
#include "prof/prof.h"
@ -33,7 +36,7 @@ static INSN_REGPARM void thumbUnknownInsn(uint32_t opcode)
CPUUndefinedException();
}
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
static INSN_REGPARM void thumbBreakpoint(uint32_t opcode)
{
reg[15].I -= 2;
@ -45,7 +48,7 @@ static INSN_REGPARM void thumbBreakpoint(uint32_t opcode)
// Common macros //////////////////////////////////////////////////////////
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
#define THUMB_CONSOLE_OUTPUT(a, b) \
do { \
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);
#define thumbUI thumbUnknownInsn
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
#define thumbBP thumbBreakpoint
#else
#define thumbBP thumbUnknownInsn
@ -2021,7 +2024,7 @@ int thumbExecute()
reg[15].I += 2;
THUMB_PREFETCH_NEXT;
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
uint32_t memAddr = armNextPC;
memoryMap* m = &map[memAddr >> 24];
if (m->breakPoints && BreakThumbCheck(m->breakPoints, memAddr & m->mask)) {
@ -2035,7 +2038,7 @@ int thumbExecute()
(*thumbInsnTable[opcode >> 6])(opcode);
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (enableRegBreak) {
if (lowRegBreakCounter[0])
breakReg_check(0);

View File

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

View File

@ -1,5 +1,5 @@
#ifndef EEPROM_H
#define EEPROM_H
#ifndef VBAM_CORE_GBA_GBAEEPROM_H_
#define VBAM_CORE_GBA_GBAEEPROM_H_
#include <cstdint>
@ -29,4 +29,4 @@ extern int eepromSize;
#define EEPROM_READDATA2 3
#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 <stdlib.h>
#include <string.h>
#include "core/base/message.h"
#include "core/base/port.h"
#include "GBA.h"
#include "elf.h"
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#define elfReadMemory(addr) \
READ32LE((&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask]))

View File

@ -1,5 +1,5 @@
#ifndef ELF_H
#define ELF_H
#ifndef VBAM_CORE_GBA_GBAELF_H_
#define VBAM_CORE_GBA_GBAELF_H_
#include <cstdint>
#include <cstdio>
@ -263,4 +263,4 @@ uint32_t elfDecodeLocation(Function*, ELFBlock*, LocationType*);
uint32_t elfDecodeLocation(Function*, ELFBlock*, LocationType*, uint32_t);
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 <math.h>
#include "core/gba/gbaFilter.h"
extern int systemColorDepth;
extern int systemRedShift;

View File

@ -1,5 +1,5 @@
#ifndef VBAM_GBA_GBAFILTER_H_
#define VBAM_GBA_GBAFILTER_H_
#ifndef VBAM_CORE_GBA_GBAFILTER_H_
#define VBAM_CORE_GBA_GBAFILTER_H_
#include <cstdint>
@ -7,4 +7,4 @@ void gbafilter_pal(uint16_t* buf, int count);
void gbafilter_pal32(uint32_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 <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include "core/base/file_util.h"
#include "GBA.h"
#include "Sram.h"
#include "core/gba/gba.h"
#include "core/gba/internal/gbaSram.h"
#define FLASH_READ_ARRAY 0
#define FLASH_CMD_1 1

View File

@ -1,5 +1,5 @@
#ifndef FLASH_H
#define FLASH_H
#ifndef VBAM_CORE_GBA_GBAFLASH_H_
#define VBAM_CORE_GBA_GBAFLASH_H_
#include <cstdint>
@ -28,4 +28,4 @@ extern void flashInit();
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)
#include <cstring>

View File

@ -1,9 +1,11 @@
#ifndef GFX_H
#define GFX_H
#ifndef VBAM_CORE_GBA_GBAGFX_H_
#define VBAM_CORE_GBA_GBAGFX_H_
#include <cstdint>
#include <cstddef>
#include "core/base/port.h"
#include "GBA.h"
#include "Globals.h"
#include "core/gba/gbaGlobals.h"
//#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];
char oldbuffer[10];
#endif
@ -17,6 +17,9 @@ bool armIrqEnable = true;
uint32_t armNextPC = 0x00000000;
int armMode = 0x1f;
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:
// -1: disabled

View File

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

View File

@ -1,17 +1,21 @@
#ifndef GBAINLINE_H
#define GBAINLINE_H
#ifndef VBAM_CORE_GBA_GBAINLINE_H_
#define VBAM_CORE_GBA_GBAINLINE_H_
#include <cstdint>
#include <type_traits>
#include "core/base/system.h"
#include "core/base/port.h"
#include "GBALink.h"
#include "GBAcpu.h"
#include "RTC.h"
#include "Sound.h"
#include "agbprint.h"
#include "remote.h"
#include "stdint.h"
#include "core/base/system.h"
#include "core/gba/gbaCpu.h"
#include "core/gba/gbaEeprom.h"
#include "core/gba/gbaFlash.h"
#include "core/gba/gbaPrint.h"
#include "core/gba/gbaRtc.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];
@ -74,7 +78,7 @@ extern uint32_t myROM[];
static inline uint32_t CPUReadMemory(uint32_t address)
{
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnRead(address, 2)) {
@ -215,7 +219,7 @@ static inline uint32_t CPUReadMemory(uint32_t address)
static inline uint32_t CPUReadHalfWord(uint32_t address)
{
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnRead(address, 1)) {
@ -362,7 +366,7 @@ static inline int16_t CPUReadHalfWordSigned(uint32_t address)
static inline uint8_t CPUReadByte(uint32_t address)
{
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakReadCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnRead(address, 0)) {
@ -467,7 +471,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
}
#endif
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnWrite(address, value, 1)) {
@ -478,7 +482,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
switch (address >> 24) {
case 0x02:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeWorkRAM[address & 0x3FFFC]))
cheatsWriteMemory(address & 0x203FFFC, value);
else
@ -486,7 +490,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
WRITE32LE(((uint32_t*)&g_workRAM[address & 0x3FFFC]), value);
break;
case 0x03:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeInternalRAM[address & 0x7ffc]))
cheatsWriteMemory(address & 0x3007FFC, value);
else
@ -501,7 +505,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
goto unwritable;
break;
case 0x05:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezePRAM[address & 0x3fc]))
cheatsWriteMemory(address & 0x70003FC, value);
else
@ -515,7 +519,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
if ((address & 0x18000) == 0x18000)
address &= 0x17fff;
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeVRAM[address]))
cheatsWriteMemory(address + 0x06000000, value);
else
@ -524,7 +528,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
WRITE32LE(((uint32_t*)&g_vram[address]), value);
break;
case 0x07:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint32_t*)&freezeOAM[address & 0x3fc]))
cheatsWriteMemory(address & 0x70003FC, value);
else
@ -572,7 +576,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
}
#endif
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnWrite(address, value, 1)) {
@ -583,7 +587,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
switch (address >> 24) {
case 2:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeWorkRAM[address & 0x3FFFE]))
cheatsWriteHalfWord(address & 0x203FFFE, value);
else
@ -591,7 +595,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
WRITE16LE(((uint16_t*)&g_workRAM[address & 0x3FFFE]), value);
break;
case 3:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeInternalRAM[address & 0x7ffe]))
cheatsWriteHalfWord(address & 0x3007ffe, value);
else
@ -605,7 +609,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
goto unwritable;
break;
case 5:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezePRAM[address & 0x03fe]))
cheatsWriteHalfWord(address & 0x70003fe, value);
else
@ -618,7 +622,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
return;
if ((address & 0x18000) == 0x18000)
address &= 0x17fff;
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeVRAM[address]))
cheatsWriteHalfWord(address + 0x06000000, value);
else
@ -626,7 +630,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
WRITE16LE(((uint16_t*)&g_vram[address]), value);
break;
case 7:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (*((uint16_t*)&freezeOAM[address & 0x03fe]))
cheatsWriteHalfWord(address & 0x70003fe, value);
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)
{
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
memoryMap* m = &map[address >> 24];
if (m->breakPoints && BreakWriteCheck(m->breakPoints, address & m->mask)) {
if (debuggerBreakOnWrite(address, b, 1)) {
@ -681,7 +685,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
switch (address >> 24) {
case 2:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (freezeWorkRAM[address & 0x3FFFF])
cheatsWriteByte(address & 0x203FFFF, b);
else
@ -689,7 +693,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
g_workRAM[address & 0x3FFFF] = b;
break;
case 3:
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (freezeInternalRAM[address & 0x7fff])
cheatsWriteByte(address & 0x3007fff, b);
else
@ -776,7 +780,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
// no need to switch
// byte writes to OBJ VRAM are ignored
if ((address) < objTilesAddress[((DISPCNT & 7) + 1) >> 2]) {
#ifdef BKPT_SUPPORT
#ifdef VBAM_ENABLE_DEBUGGER
if (freezeVRAM[address])
cheatsWriteByte(address + 0x06000000, b);
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
// 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 <cstdlib>
#include <cstring>
#include <string>
// malloc.h does not seem to exist on Mac OS 10.7 and is an error on FreeBSD
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
#include <stdlib.h>
#include <SFML/Network.hpp>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) gettext(x)
#else
#include <malloc.h>
#define _(x) x
#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
#define snprintf _snprintf
#endif
@ -33,8 +63,6 @@ const char* MakeInstanceFilename(const char* Input)
return result;
}
#ifndef NO_LINK
enum {
SENDING = 0,
RECEIVING = 1
@ -50,10 +78,6 @@ enum siocnt_lo_32bit {
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
bool gba_link_enabled = false;
@ -67,29 +91,7 @@ uint16_t IP_LINK_PORT = 5738;
std::string IP_LINK_BIND_ADDRESS = "*";
#include "core/base/message.h"
#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>
#if !defined(_WIN32)
#define ReleaseSemaphore(sem, nrel, orel) \
do { \
@ -97,7 +99,9 @@ std::string IP_LINK_BIND_ADDRESS = "*";
sem_post(sem); \
} while (0)
#define WAIT_TIMEOUT -1
#ifdef HAVE_SEM_TIMEDWAIT
int WaitForSingleObject(sem_t* s, int t)
{
struct timespec ts;
@ -334,7 +338,7 @@ bool EmuReseted = true;
bool LinkIsWaiting = false;
bool LinkFirstTime = true;
#if (defined __WIN32__ || defined _WIN32)
#if (defined _WIN32)
static ConnectionState InitIPC();
static void StartCableIPC(uint16_t siocnt);
@ -4136,7 +4140,3 @@ static void CloseIPC()
}
#endif
#else
bool gba_joybus_active = false;
#endif

View File

@ -1,9 +1,13 @@
#ifndef GBA_GBALINK_H
#define GBA_GBALINK_H
#ifndef VBAM_CORE_GBA_GBALINK_H_
#define VBAM_CORE_GBA_GBALINK_H_
#include <cstdint>
#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 std::string IP_LINK_BIND_ADDRESS;
@ -143,28 +147,6 @@ extern void CleanLocalLink();
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_RECV_COMPLETE 2
#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);
#endif /* GBA_GBALINK_H */
#endif // VBAM_CORE_GBA_GBALINK_H_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,11 @@
#ifndef REMOTE_H
#define REMOTE_H
#ifndef VBAM_CORE_GBA_GBAREMOTE_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))
@ -27,8 +31,6 @@
#define BreakCheck(array, addr, flag) \
((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf))
extern bool debugger;
extern bool dexp_eval(char*, uint32_t*);
extern void dexp_setVar(char*, uint32_t);
extern void dexp_listVars();
@ -76,4 +78,4 @@ void remoteOutput(const char* s, uint32_t addr);
void remoteSetProtocol(int p);
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 <ctime>
@ -6,9 +6,8 @@
#include "core/base/file_util.h"
#include "core/base/message.h"
#include "core/base/port.h"
#include "GBA.h"
#include "GBAinline.h"
#include "Globals.h"
#include "core/gba/gba.h"
#include "core/gba/gbaInline.h"
enum RTCSTATE {

View File

@ -1,5 +1,5 @@
#ifndef RTC_H
#define RTC_H
#ifndef VBAM_CORE_GBA_GBARTC_H_
#define VBAM_CORE_GBA_GBARTC_H_
#include <cstdint>
@ -23,4 +23,4 @@ void rtcReadGame(gzFile gzFile);
void rtcSaveGame(gzFile gzFile);
#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 <cstring>
#include "core/apu/Gb_Apu.h"
#include "core/apu/Multi_Buffer.h"
#include "core/base/file_util.h"
#include "core/base/port.h"
#include "core/base/sound_driver.h"
#include "GBA.h"
#include "Globals.h"
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#include "../apu/Gb_Apu.h"
#include "../apu/Multi_Buffer.h"
#define NR10 0x60
#define NR11 0x62

View File

@ -1,5 +1,5 @@
#ifndef SOUND_H
#define SOUND_H
#ifndef VBAM_CORE_GBA_GBASOUND_H_
#define VBAM_CORE_GBA_GBASOUND_H_
#include <cstdint>
@ -92,4 +92,4 @@ class Multi_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 <memory.h>
#include <stdlib.h>
#include "core/gba/internal/gbaBios.h"
#include "GBA.h"
#include "GBAinline.h"
#include "Globals.h"
#include "bios.h"
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "core/gba/gba.h"
#include "core/gba/gbaGlobals.h"
#include "core/gba/gbaInline.h"
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,

View File

@ -1,5 +1,7 @@
#ifndef BIOS_H
#define BIOS_H
#ifndef VBAM_CORE_GBA_INTERNAL_GBABIOS_H_
#define VBAM_CORE_GBA_INTERNAL_GBABIOS_H_
#include <cstdint>
extern void BIOS_ArcTan();
extern void BIOS_ArcTan2();
@ -33,4 +35,4 @@ extern void BIOS_SndDriverVSyncOff();
extern void BIOS_SndDriverVSyncOn();
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
sw, sword, int32_t, int --> signed word
*/
#include "core/gba/internal/gbaBreakpoint.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(VBAM_ENABLE_DEBUGGER)
#error "This file should only be compiled when VBAM_ENABLE_DEBUGGER is defined."
#endif // !defined(VBAM_ENABLE_DEBUGGER)
#include "BreakpointStructures.h"
#include "remote.h"
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "core/gba/gba.h"
#include "core/gba/gbaRemote.h"
#if (defined __WIN32__ || defined _WIN32)
#define strdup _strdup

View File

@ -1,5 +1,9 @@
#ifndef VBA_BKS_H
#define VBA_BKS_H
#ifndef VBAM_CORE_GBA_INTERNAL_GBABREAKPOINT_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>
@ -63,4 +67,5 @@ bool doBreak(struct ConditionalBreak* toTest);
// uint8_t printConditionalsFromAddress(uint32_t address);
// void printAllFlagConditionals(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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "core/gba/internal/gbaEreader.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "core/base/file_util.h"
#include "GBA.h"
#include "GBAinline.h"
#include "Globals.h"
#include "ereader.h"
#include "core/gba/gba.h"
#include "core/gba/gbaInline.h"
#include "core/gba/gbaGlobals.h"
char US_Ereader[19] = "CARDE READERPSAE01";
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 char filebuffer[];
int OpenDotCodeFile(void);
int CheckEReaderRegion(void);
int LoadDotCodeData(int size, uint32_t* DCdata, unsigned long MEM1, unsigned long MEM2);
void EReaderWriteMemory(uint32_t address, uint32_t value);
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
@ -95,4 +97,3 @@ bool GBASockClient::IsDisconnected()
{
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>
@ -26,3 +31,5 @@ private:
int32_t clock_sync;
bool is_disconnected;
};
#endif // VBAM_CORE_GBA_INTERNAL_GBASOCKCLIENT_H_

View File

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

View File

@ -1,5 +1,5 @@
#ifndef SRAM_H
#define SRAM_H
#ifndef VBAM_CORE_GBA_INTERNAL_GBASRAM_H_
#define VBAM_CORE_GBA_INTERNAL_GBASRAM_H_
#include <cstdint>
@ -7,4 +7,4 @@ uint8_t sramRead(uint32_t address);
void sramWrite(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