Remove Jerryscript further
This commit is contained in:
@@ -1,96 +0,0 @@
|
|||||||
# Copyright (c) 2026 Dominic Masters
|
|
||||||
#
|
|
||||||
# This software is released under the MIT License.
|
|
||||||
# https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
# Turn things off we don't need
|
|
||||||
set(JERRY_CMDLINE OFF CACHE BOOL "" FORCE)
|
|
||||||
set(JERRY_EXT ON CACHE BOOL "" FORCE)
|
|
||||||
set(JERRY_DEBUGGER OFF CACHE BOOL "" FORCE)
|
|
||||||
set(JERRY_BUILTIN_DATE OFF CACHE BOOL "" FORCE)
|
|
||||||
set(ENABLE_LTO OFF CACHE BOOL "" FORCE)
|
|
||||||
|
|
||||||
# Fetch Jerry
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(
|
|
||||||
jerryscript
|
|
||||||
GIT_REPOSITORY https://git.wish.moe/YourWishes/jerryscript
|
|
||||||
GIT_TAG float32-fix
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(jerryscript)
|
|
||||||
|
|
||||||
# Mark found
|
|
||||||
set(jerryscript_FOUND ON)
|
|
||||||
|
|
||||||
# Define targets
|
|
||||||
if(TARGET jerryscript-core)
|
|
||||||
set(JERRY_CORE_TARGET jerryscript-core)
|
|
||||||
elseif(TARGET jerry-core)
|
|
||||||
set(JERRY_CORE_TARGET jerry-core)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET jerryscript-ext)
|
|
||||||
set(JERRY_EXT_TARGET jerryscript-ext)
|
|
||||||
elseif(TARGET jerry-ext)
|
|
||||||
set(JERRY_EXT_TARGET jerry-ext)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET jerryscript-port-default)
|
|
||||||
set(JERRY_PORT_TARGET jerryscript-port-default)
|
|
||||||
elseif(TARGET jerry-port-default)
|
|
||||||
set(JERRY_PORT_TARGET jerry-port-default)
|
|
||||||
elseif(TARGET jerryscript-port)
|
|
||||||
set(JERRY_PORT_TARGET jerryscript-port)
|
|
||||||
elseif(TARGET jerry-port)
|
|
||||||
set(JERRY_PORT_TARGET jerry-port)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT JERRY_CORE_TARGET)
|
|
||||||
message(FATAL_ERROR "JerryScript core target not found")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT JERRY_EXT_TARGET)
|
|
||||||
message(FATAL_ERROR "JerryScript ext target not found")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT JERRY_PORT_TARGET)
|
|
||||||
message(FATAL_ERROR "JerryScript port target not found")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(tgt IN ITEMS
|
|
||||||
${JERRY_CORE_TARGET}
|
|
||||||
${JERRY_EXT_TARGET}
|
|
||||||
${JERRY_PORT_TARGET}
|
|
||||||
)
|
|
||||||
if(TARGET ${tgt})
|
|
||||||
set_property(TARGET ${tgt} PROPERTY INTERPROCEDURAL_OPTIMIZATION OFF)
|
|
||||||
target_compile_definitions(${JERRY_CORE_TARGET} PRIVATE
|
|
||||||
JERRY_NUMBER_TYPE_FLOAT64=0
|
|
||||||
JERRY_BUILTIN_DATE=0
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Export include dirs through the targets
|
|
||||||
target_include_directories(${JERRY_CORE_TARGET} INTERFACE
|
|
||||||
${jerryscript_SOURCE_DIR}/jerry-core/include
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${JERRY_EXT_TARGET} INTERFACE
|
|
||||||
${jerryscript_SOURCE_DIR}/jerry-ext/include
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${JERRY_PORT_TARGET} INTERFACE
|
|
||||||
${jerryscript_SOURCE_DIR}/jerry-port/default/include
|
|
||||||
)
|
|
||||||
|
|
||||||
# Suppress JerryScript-only warning
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
||||||
target_compile_options(${JERRY_CORE_TARGET} PRIVATE
|
|
||||||
-Wno-error
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(jerryscript::core ALIAS ${JERRY_CORE_TARGET})
|
|
||||||
add_library(jerryscript::ext ALIAS ${JERRY_EXT_TARGET})
|
|
||||||
add_library(jerryscript::port ALIAS ${JERRY_PORT_TARGET})
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
# Fixes some problems building JerryScript
|
|
||||||
set(CMAKE_AR "$ENV{PSPDEV}/bin/psp-ar" CACHE FILEPATH "" FORCE)
|
set(CMAKE_AR "$ENV{PSPDEV}/bin/psp-ar" CACHE FILEPATH "" FORCE)
|
||||||
set(CMAKE_RANLIB "$ENV{PSPDEV}/bin/psp-ranlib" CACHE FILEPATH "" FORCE)
|
set(CMAKE_RANLIB "$ENV{PSPDEV}/bin/psp-ranlib" CACHE FILEPATH "" FORCE)
|
||||||
set(CMAKE_C_COMPILER_AR "$ENV{PSPDEV}/bin/psp-ar" CACHE FILEPATH "" FORCE)
|
set(CMAKE_C_COMPILER_AR "$ENV{PSPDEV}/bin/psp-ar" CACHE FILEPATH "" FORCE)
|
||||||
@@ -8,9 +7,7 @@ set(CMAKE_C_ARCHIVE_APPEND "$ENV{PSPDEV}/bin/psp-ar q <TARGET> <LINK_FLAGS> <OBJ
|
|||||||
set(CMAKE_C_ARCHIVE_FINISH "$ENV{PSPDEV}/bin/psp-ranlib <TARGET>")
|
set(CMAKE_C_ARCHIVE_FINISH "$ENV{PSPDEV}/bin/psp-ranlib <TARGET>")
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "" FORCE)
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "" FORCE)
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_C OFF CACHE BOOL "" FORCE)
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_C OFF CACHE BOOL "" FORCE)
|
||||||
set(JERRY_LTO OFF CACHE BOOL "" FORCE)
|
|
||||||
|
|
||||||
find_package(jerryscript REQUIRED)
|
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
target_link_libraries(${DUSK_BINARY_TARGET_NAME} PUBLIC
|
target_link_libraries(${DUSK_BINARY_TARGET_NAME} PUBLIC
|
||||||
@@ -42,10 +39,6 @@ target_link_libraries(${DUSK_BINARY_TARGET_NAME} PUBLIC
|
|||||||
pspnet_apctl
|
pspnet_apctl
|
||||||
psphttp
|
psphttp
|
||||||
pspssl
|
pspssl
|
||||||
|
|
||||||
jerryscript::core
|
|
||||||
jerryscript::ext
|
|
||||||
jerryscript::port
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${DUSK_BINARY_TARGET_NAME} PRIVATE
|
target_include_directories(${DUSK_BINARY_TARGET_NAME} PRIVATE
|
||||||
|
|||||||
@@ -7,12 +7,11 @@
|
|||||||
#include "error/error.h"
|
#include "error/error.h"
|
||||||
|
|
||||||
#define CUTSCENE_EVENT_COUNT_MAX 16
|
#define CUTSCENE_EVENT_COUNT_MAX 16
|
||||||
#define CUTSCENE_SCRIPT_REF_NONE ((jerry_value_t)0)
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
errorret_t (*onStart)(void);
|
errorret_t (*onStart)(void);
|
||||||
errorret_t (*onEnd)(void);
|
errorret_t (*onEnd)(void);
|
||||||
errorret_t (*onUpdate)(void);
|
errorret_t (*onUpdate)(void);
|
||||||
} cutsceneevent_t;
|
} cutsceneevent_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -26,16 +26,6 @@
|
|||||||
#include "item/backpack.h"
|
#include "item/backpack.h"
|
||||||
#include "save/save.h"
|
#include "save/save.h"
|
||||||
|
|
||||||
double jerry_port_current_time(void) {
|
|
||||||
dusktimeepoch_t epoch = timeGetEpoch();
|
|
||||||
return epoch.time * 1000.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t jerry_port_local_tza(double unix_ms) {
|
|
||||||
(void) unix_ms;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
engine_t ENGINE;
|
engine_t ENGINE;
|
||||||
|
|
||||||
errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
||||||
|
|||||||
@@ -8,3 +8,6 @@ target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
scene.c
|
scene.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Subdirectories
|
||||||
|
add_subdirectory(initial)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Copyright (c) 2026 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
initialscene.c
|
||||||
|
)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "initialscene.h"
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "scene/scene.h"
|
||||||
|
|
||||||
|
void initialSceneInit(void);
|
||||||
|
errorret_t initialSceneUpdate(void);
|
||||||
|
errorret_t initialSceneDraw(void);
|
||||||
|
void initialSceneDispose(void);
|
||||||
|
|
||||||
|
static const scene_t INITIAL_SCENE = {
|
||||||
|
.init = initialSceneInit,
|
||||||
|
.update = initialSceneUpdate,
|
||||||
|
.draw = initialSceneDraw,
|
||||||
|
.dispose = initialSceneDispose
|
||||||
|
};
|
||||||
+20
-9
@@ -18,10 +18,15 @@
|
|||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
scene_t SCENE;
|
scene_t SCENE_CURRENT;
|
||||||
|
scene_t SCENE_NEXT;
|
||||||
|
bool_t SCENE_NEXT_SET;
|
||||||
|
|
||||||
errorret_t sceneInit(void) {
|
errorret_t sceneInit(void) {
|
||||||
memoryZero(&SCENE, sizeof(scene_t));
|
memoryZero(&SCENE_CURRENT, sizeof(scene_t));
|
||||||
|
memoryZero(&SCENE_NEXT, sizeof(scene_t));
|
||||||
|
SCENE_NEXT_SET = false;
|
||||||
|
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +37,15 @@ errorret_t sceneUpdate(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(SCENE_NEXT_SET) {
|
||||||
|
if(SCENE_CURRENT.dispose) SCENE_CURRENT.dispose();
|
||||||
|
SCENE_CURRENT = SCENE_NEXT;
|
||||||
|
SCENE_NEXT_SET = false;
|
||||||
|
if(SCENE_CURRENT.init) SCENE_CURRENT.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SCENE_CURRENT.update != NULL) errorChain(SCENE_CURRENT.update());
|
||||||
|
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,13 +172,10 @@ errorret_t sceneRender(void) {
|
|||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
// void sceneSet(const char_t *scene) {
|
void sceneSet(const scene_t scene) {
|
||||||
// stringCopy(
|
SCENE_NEXT = scene;
|
||||||
// SCENE.sceneNext,
|
SCENE_NEXT_SET = true;
|
||||||
// scene == NULL ? "" : scene,
|
}
|
||||||
// ASSET_FILE_NAME_MAX
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
errorret_t sceneDispose(void) {
|
errorret_t sceneDispose(void) {
|
||||||
errorOk();
|
errorOk();
|
||||||
|
|||||||
@@ -11,11 +11,14 @@
|
|||||||
#define SCENE_EVENT_UPDATE_MAX 16
|
#define SCENE_EVENT_UPDATE_MAX 16
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *nothing;
|
void (*init)(void);
|
||||||
|
errorret_t (*update)(void);
|
||||||
|
void (*dispose)(void);
|
||||||
} scene_t;
|
} scene_t;
|
||||||
|
|
||||||
extern scene_t SCENE;
|
extern scene_t SCENE_CURRENT;
|
||||||
|
extern scene_t SCENE_NEXT;
|
||||||
|
extern bool_t SCENE_NEXT_SET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the scene manager.
|
* Initializes the scene manager.
|
||||||
@@ -43,7 +46,7 @@ errorret_t sceneRender(void);
|
|||||||
*
|
*
|
||||||
* @param scene Which scene to set.
|
* @param scene Which scene to set.
|
||||||
*/
|
*/
|
||||||
// void sceneSet(const char_t *scene);
|
void sceneSet(const scene_t scene);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes of the current scene.
|
* Disposes of the current scene.
|
||||||
|
|||||||
Reference in New Issue
Block a user