[nostalgia/core] Add NostalgiaCore-Headless

This commit is contained in:
Gary Talent 2022-02-17 21:26:56 -06:00
parent c1fc3d48b2
commit fba203a1e7
5 changed files with 164 additions and 2 deletions

View File

@ -46,13 +46,23 @@ else()
endif()
add_library(
NostalgiaCore
NostalgiaCore
gfx.cpp
media.cpp
typeconv.cpp
${NOSTALGIA_CORE_IMPL_SRC}
)
add_library(
NostalgiaCore-Headless
gfx.cpp
media.cpp
typeconv.cpp
headless/core.cpp
headless/gfx.cpp
headless/media.cpp
)
if(NOT MSVC)
target_compile_options(NostalgiaCore PUBLIC -Wsign-conversion)
endif()
@ -64,6 +74,12 @@ target_link_libraries(
${NOSTALGIA_CORE_IMPL_LIBS}
)
target_link_libraries(
NostalgiaCore-Headless PUBLIC
OxClaw
OxFS
)
if(NOSTALGIA_BUILD_STUDIO)
add_subdirectory(studio)
endif()
@ -88,6 +104,7 @@ install(
install(
TARGETS
NostalgiaCore
NostalgiaCore-Headless
DESTINATION
LIBRARY DESTINATION lib/nostalgia
ARCHIVE DESTINATION lib/nostalgia

View File

@ -0,0 +1,25 @@
/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <nostalgia/core/core.hpp>
#include <nostalgia/core/input.hpp>
namespace nostalgia::core {
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem>, const char*) noexcept {
return OxError(1);
}
void setEventHandler(Context*, event_handler) noexcept {
}
uint64_t ticksMs(Context*) noexcept {
return 0;
}
bool buttonDown(Context*, Key) noexcept {
return false;
}
}

View File

@ -0,0 +1,102 @@
/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <nostalgia/core/context.hpp>
#include <nostalgia/core/gfx.hpp>
namespace nostalgia::core {
ox::Error initGfx(Context*) noexcept {
return OxError(0);
}
ox::Error shutdownGfx(Context*) noexcept {
return OxError(0);
}
void setWindowTitle(Context*, const char*) noexcept {
}
void focusWindow(Context*) noexcept {
}
int getScreenWidth(Context*) noexcept {
return 0;
}
int getScreenHeight(Context*) noexcept {
return 0;
}
geo::Size getScreenSize(Context*) noexcept {
return {0, 0};
}
uint8_t bgStatus(Context*) noexcept {
return 0;
}
void setBgStatus(Context*, uint32_t) noexcept {
}
bool bgStatus(Context*, unsigned) noexcept {
return false;
}
void setBgStatus(Context*, unsigned, bool) noexcept {
}
// Do NOT rely on Context in the GBA version of this function.
ox::Error initConsole(Context*) noexcept {
return OxError(0);
}
ox::Error loadBgTileSheet(Context*,
int,
const ox::FileAddress&,
const ox::FileAddress&) noexcept {
return OxError(0);
}
ox::Error loadSpriteTileSheet(Context*,
int,
const ox::FileAddress&,
const ox::FileAddress&) noexcept {
return OxError(0);
}
ox::Error loadBgPalette(Context*, int, const ox::FileAddress&) noexcept {
return OxError(0);
}
ox::Error loadSpritePalette(Context*, int, const ox::FileAddress&) noexcept {
return OxError(0);
}
// Do NOT use Context in the GBA version of this function.
void puts(Context*, int, int, const char*) noexcept {
}
void setTile(Context*, int, int, int, uint8_t) noexcept {
}
// Do NOT use Context in the GBA version of this function.
void clearTileLayer(Context*, int) noexcept {
}
[[maybe_unused]]
void hideSprite(Context*, unsigned) noexcept {
}
void setSprite(Context*,
unsigned,
unsigned,
unsigned,
unsigned,
unsigned,
unsigned,
unsigned) noexcept {
}
}

View File

@ -0,0 +1,18 @@
/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/std/std.hpp>
#include "../media.hpp"
namespace nostalgia::core {
ox::Result<char*> loadRom(const char*) noexcept {
return OxError(1);
}
void unloadRom(char*) noexcept {
}
}

View File

@ -8,7 +8,7 @@ target_link_libraries(
NostalgiaPack PUBLIC
OxClaw
OxFS
NostalgiaCore
NostalgiaCore-Headless
NostalgiaGeo
)