[nostalgia/core] Add NostalgiaCore-Headless
This commit is contained in:
parent
c1fc3d48b2
commit
fba203a1e7
@ -46,13 +46,23 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(
|
add_library(
|
||||||
NostalgiaCore
|
NostalgiaCore
|
||||||
gfx.cpp
|
gfx.cpp
|
||||||
media.cpp
|
media.cpp
|
||||||
typeconv.cpp
|
typeconv.cpp
|
||||||
${NOSTALGIA_CORE_IMPL_SRC}
|
${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)
|
if(NOT MSVC)
|
||||||
target_compile_options(NostalgiaCore PUBLIC -Wsign-conversion)
|
target_compile_options(NostalgiaCore PUBLIC -Wsign-conversion)
|
||||||
endif()
|
endif()
|
||||||
@ -64,6 +74,12 @@ target_link_libraries(
|
|||||||
${NOSTALGIA_CORE_IMPL_LIBS}
|
${NOSTALGIA_CORE_IMPL_LIBS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
NostalgiaCore-Headless PUBLIC
|
||||||
|
OxClaw
|
||||||
|
OxFS
|
||||||
|
)
|
||||||
|
|
||||||
if(NOSTALGIA_BUILD_STUDIO)
|
if(NOSTALGIA_BUILD_STUDIO)
|
||||||
add_subdirectory(studio)
|
add_subdirectory(studio)
|
||||||
endif()
|
endif()
|
||||||
@ -88,6 +104,7 @@ install(
|
|||||||
install(
|
install(
|
||||||
TARGETS
|
TARGETS
|
||||||
NostalgiaCore
|
NostalgiaCore
|
||||||
|
NostalgiaCore-Headless
|
||||||
DESTINATION
|
DESTINATION
|
||||||
LIBRARY DESTINATION lib/nostalgia
|
LIBRARY DESTINATION lib/nostalgia
|
||||||
ARCHIVE DESTINATION lib/nostalgia
|
ARCHIVE DESTINATION lib/nostalgia
|
||||||
|
25
src/nostalgia/core/headless/core.cpp
Normal file
25
src/nostalgia/core/headless/core.cpp
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
102
src/nostalgia/core/headless/gfx.cpp
Normal file
102
src/nostalgia/core/headless/gfx.cpp
Normal 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 {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
18
src/nostalgia/core/headless/media.cpp
Normal file
18
src/nostalgia/core/headless/media.cpp
Normal 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 {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,7 +8,7 @@ target_link_libraries(
|
|||||||
NostalgiaPack PUBLIC
|
NostalgiaPack PUBLIC
|
||||||
OxClaw
|
OxClaw
|
||||||
OxFS
|
OxFS
|
||||||
NostalgiaCore
|
NostalgiaCore-Headless
|
||||||
NostalgiaGeo
|
NostalgiaGeo
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user