[nostalgia,turbine] Make GBA files (other than ARM asm) build on all platforms
This commit is contained in:
parent
7c1c9a697e
commit
56e980385c
@ -45,10 +45,9 @@ add_subdirectory(deps/ox)
|
|||||||
include_directories(
|
include_directories(
|
||||||
deps/ox/src
|
deps/ox/src
|
||||||
)
|
)
|
||||||
|
add_subdirectory(deps/teagba)
|
||||||
|
|
||||||
if(BUILDCORE_TARGET STREQUAL "gba")
|
if(NOT BUILDCORE_TARGET STREQUAL "gba")
|
||||||
add_subdirectory(deps/teagba)
|
|
||||||
else()
|
|
||||||
include_directories(
|
include_directories(
|
||||||
SYSTEM
|
SYSTEM
|
||||||
deps/glfw/deps
|
deps/glfw/deps
|
||||||
|
@ -3,9 +3,8 @@ add_library(
|
|||||||
gfx.cpp
|
gfx.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
add_subdirectory(gba)
|
||||||
add_subdirectory(gba)
|
if(NOT TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||||
else()
|
|
||||||
add_subdirectory(opengl)
|
add_subdirectory(opengl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
enable_language(CXX ASM)
|
add_library(
|
||||||
set_source_files_properties(gfx.cpp PROPERTIES COMPILE_FLAGS -marm)
|
NostalgiaCore-GBA OBJECT
|
||||||
target_sources(
|
|
||||||
NostalgiaCore PRIVATE
|
|
||||||
context.cpp
|
context.cpp
|
||||||
gfx.cpp
|
gfx.cpp
|
||||||
panic.cpp
|
panic.cpp
|
||||||
)
|
)
|
||||||
|
target_include_directories(
|
||||||
|
NostalgiaCore-GBA PUBLIC
|
||||||
|
../../include
|
||||||
|
)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
NostalgiaCore PUBLIC
|
NostalgiaCore-GBA PUBLIC
|
||||||
TeaGBA
|
TeaGBA
|
||||||
)
|
Keel
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||||
|
set_source_files_properties(gfx.cpp PROPERTIES COMPILE_FLAGS -marm)
|
||||||
|
target_link_libraries(NostalgiaCore PUBLIC NostalgiaCore-GBA)
|
||||||
|
endif()
|
@ -197,7 +197,7 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
|
|||||||
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
|
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
|
||||||
const auto col = static_cast<unsigned>(column);
|
const auto col = static_cast<unsigned>(column);
|
||||||
for (auto i = 0u; i < str.bytes(); i++) {
|
for (auto i = 0u; i < str.bytes(); i++) {
|
||||||
const auto c = charMap[static_cast<unsigned>(str[i])];
|
const auto c = charMap[static_cast<std::size_t>(str[i])];
|
||||||
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(c));
|
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,8 @@ add_library(
|
|||||||
event.cpp
|
event.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
add_subdirectory(gba)
|
||||||
add_subdirectory(gba)
|
if(NOT TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||||
else()
|
|
||||||
add_subdirectory(glfw)
|
add_subdirectory(glfw)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,16 +1,33 @@
|
|||||||
enable_language(CXX ASM)
|
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||||
set_source_files_properties(turbine.arm.cpp irq.arm.cpp PROPERTIES COMPILE_FLAGS -marm)
|
enable_language(CXX ASM)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(Turbine-GBA OBJECT)
|
||||||
target_sources(
|
target_sources(
|
||||||
Turbine PRIVATE
|
Turbine-GBA PRIVATE
|
||||||
clipboard.cpp
|
clipboard.cpp
|
||||||
gfx.cpp
|
gfx.cpp
|
||||||
irq.arm.cpp
|
irq.arm.cpp
|
||||||
irq.s
|
|
||||||
turbine.arm.cpp
|
turbine.arm.cpp
|
||||||
turbine.cpp
|
turbine.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||||
|
set_source_files_properties(turbine.arm.cpp irq.arm.cpp PROPERTIES COMPILE_FLAGS -marm)
|
||||||
|
target_sources(
|
||||||
|
Turbine-GBA PRIVATE
|
||||||
|
irq.s
|
||||||
|
)
|
||||||
|
target_link_libraries(Turbine PUBLIC Turbine-GBA)
|
||||||
|
else()
|
||||||
|
target_sources(
|
||||||
|
Turbine-GBA PRIVATE
|
||||||
|
irqstub.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
Turbine PUBLIC
|
Turbine-GBA PUBLIC
|
||||||
TeaGBA
|
TeaGBA
|
||||||
|
Keel
|
||||||
)
|
)
|
||||||
|
8
src/turbine/gba/irqstub.cpp
Normal file
8
src/turbine/gba/irqstub.cpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// stub for building TeaGBA for PC targets, for purposes of not having to
|
||||||
|
// switch back and forth between builds when editing GBA files
|
||||||
|
|
||||||
|
extern "C" void turbine_isr() {}
|
@ -36,6 +36,7 @@ static void initTimer() noexcept {
|
|||||||
REG_IE = REG_IE | teagba::Int_timer0;
|
REG_IE = REG_IE | teagba::Int_timer0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[maybe_unused]]
|
||||||
static ox::Result<std::size_t> findPreloadSection() noexcept {
|
static ox::Result<std::size_t> findPreloadSection() noexcept {
|
||||||
// put the header in the wrong order to prevent mistaking this code for the
|
// put the header in the wrong order to prevent mistaking this code for the
|
||||||
// media section
|
// media section
|
||||||
@ -55,7 +56,9 @@ static ox::Result<std::size_t> findPreloadSection() noexcept {
|
|||||||
|
|
||||||
ox::Result<ox::UniquePtr<turbine::Context>> init(ox::UPtr<ox::FileSystem> fs, ox::CRStringView appName) noexcept {
|
ox::Result<ox::UniquePtr<turbine::Context>> init(ox::UPtr<ox::FileSystem> fs, ox::CRStringView appName) noexcept {
|
||||||
oxRequireM(ctx, keel::init<gba::Context>(std::move(fs), appName));
|
oxRequireM(ctx, keel::init<gba::Context>(std::move(fs), appName));
|
||||||
|
#ifdef OX_BARE_METAL
|
||||||
oxReturnError(findPreloadSection().moveTo(&ctx->preloadSectionOffset));
|
oxReturnError(findPreloadSection().moveTo(&ctx->preloadSectionOffset));
|
||||||
|
#endif
|
||||||
oxReturnError(initGfx(*ctx));
|
oxReturnError(initGfx(*ctx));
|
||||||
initTimer();
|
initTimer();
|
||||||
initIrq();
|
initIrq();
|
||||||
|
Loading…
Reference in New Issue
Block a user