Merge remote-tracking branch 'upstream/master'

This commit is contained in:
olebeck 2025-07-10 18:34:41 +02:00
commit 519ca1e1e2
31 changed files with 669 additions and 170 deletions

View File

@ -41,6 +41,7 @@ jobs:
- { name: 'msys2 mingw32', os: 'windows-latest', generator: 'Ninja', dx5: false, config: false, mingw: true, werror: true, clang-tidy: true, msystem: 'mingw32', msys-env: 'mingw-w64-i686', shell: 'msys2 {0}' } - { name: 'msys2 mingw32', os: 'windows-latest', generator: 'Ninja', dx5: false, config: false, mingw: true, werror: true, clang-tidy: true, msystem: 'mingw32', msys-env: 'mingw-w64-i686', shell: 'msys2 {0}' }
- { name: 'msys2 mingw64', os: 'windows-latest', generator: 'Ninja', dx5: false, config: true, mingw: true, werror: true, clang-tidy: true, msystem: 'mingw64', msys-env: 'mingw-w64-x86_64', shell: 'msys2 {0}' } - { name: 'msys2 mingw64', os: 'windows-latest', generator: 'Ninja', dx5: false, config: true, mingw: true, werror: true, clang-tidy: true, msystem: 'mingw64', msys-env: 'mingw-w64-x86_64', shell: 'msys2 {0}' }
- { name: 'macOS', os: 'macos-latest', generator: 'Ninja', dx5: false, config: true, brew: true, werror: true, clang-tidy: false } - { name: 'macOS', os: 'macos-latest', generator: 'Ninja', dx5: false, config: true, brew: true, werror: true, clang-tidy: false }
- { name: 'iOS', os: 'macos-15', generator: 'Xcode', dx5: false, config: false, brew: true, werror: true, clang-tidy: false, cmake-args: '-DCMAKE_SYSTEM_NAME=iOS' }
- { name: 'Emscripten', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' } - { name: 'Emscripten', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' }
- { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' } - { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' }
- { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true} - { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true}

View File

@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR)
project(isle LANGUAGES CXX C VERSION 0.1) project(isle LANGUAGES CXX C VERSION 0.1)
if (IOS)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
add_compile_definitions(IOS)
endif()
if (WINDOWS_STORE) if (WINDOWS_STORE)
add_compile_definitions(WINDOWS_STORE) add_compile_definitions(WINDOWS_STORE)
endif() endif()
@ -42,6 +48,7 @@ option(ISLE_WERROR "Treat warnings as errors" OFF)
cmake_dependent_option(ISLE_DEBUG "Enable imgui debug" ON "NOT VITA" OFF) cmake_dependent_option(ISLE_DEBUG "Enable imgui debug" ON "NOT VITA" OFF)
cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF) cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF) cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF)
cmake_dependent_option(ISLE_EXTENSIONS "Use extensions" ON "NOT ISLE_USE_DX5" OFF)
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN;NOT NINTENDO_3DS;NOT WINDOWS_STORE;NOT VITA" OFF) cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN;NOT NINTENDO_3DS;NOT WINDOWS_STORE;NOT VITA" OFF)
cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF) cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF)
cmake_dependent_option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON "NOT VITA" OFF) cmake_dependent_option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON "NOT VITA" OFF)
@ -55,6 +62,7 @@ message(STATUS "Isle app: ${ISLE_BUILD_APP}")
message(STATUS "Config app: ${ISLE_BUILD_CONFIG}") message(STATUS "Config app: ${ISLE_BUILD_CONFIG}")
message(STATUS "Internal DirectX5 SDK: ${ISLE_USE_DX5}") message(STATUS "Internal DirectX5 SDK: ${ISLE_USE_DX5}")
message(STATUS "Internal miniwin: ${ISLE_MINIWIN}") message(STATUS "Internal miniwin: ${ISLE_MINIWIN}")
message(STATUS "Isle extensions: ${ISLE_EXTENSIONS}")
message(STATUS "Isle debugging: ${ISLE_DEBUG}") message(STATUS "Isle debugging: ${ISLE_DEBUG}")
message(STATUS "Compile shaders: ${ISLE_COMPILE_SHADERS}") message(STATUS "Compile shaders: ${ISLE_COMPILE_SHADERS}")
@ -167,6 +175,7 @@ add_library(lego1
target_precompile_headers(lego1 PRIVATE "LEGO1/lego1_pch.h") target_precompile_headers(lego1 PRIVATE "LEGO1/lego1_pch.h")
set_property(TARGET lego1 PROPERTY DEFINE_SYMBOL "LEGO1_DLL") set_property(TARGET lego1 PROPERTY DEFINE_SYMBOL "LEGO1_DLL")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>") target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/extensions/include>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1>") target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/omni/include>") target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/omni/include>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/sources>") target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/sources>")
@ -484,6 +493,14 @@ if (NOT ISLE_MINIWIN)
target_compile_definitions(lego1 PRIVATE DIRECTINPUT_VERSION=0x0500) target_compile_definitions(lego1 PRIVATE DIRECTINPUT_VERSION=0x0500)
endif() endif()
if (ISLE_EXTENSIONS)
target_compile_definitions(lego1 PUBLIC EXTENSIONS)
target_sources(lego1 PRIVATE
extensions/src/extensions.cpp
extensions/src/textureloader.cpp
)
endif()
if (ISLE_BUILD_APP) if (ISLE_BUILD_APP)
add_executable(isle WIN32 add_executable(isle WIN32
ISLE/res/isle.rc ISLE/res/isle.rc
@ -554,6 +571,11 @@ if (ISLE_BUILD_APP)
ISLE/xbox_one_series/config.cpp ISLE/xbox_one_series/config.cpp
) )
endif() endif()
if (IOS)
target_sources(isle PRIVATE
ISLE/ios/config.cpp
)
endif()
if(VITA) if(VITA)
target_sources(isle PRIVATE target_sources(isle PRIVATE
ISLE/vita/config.cpp ISLE/vita/config.cpp
@ -843,8 +865,12 @@ if(VITA)
install(DIRECTORY packaging/vita/sce_sys DESTINATION .) install(DIRECTORY packaging/vita/sce_sys DESTINATION .)
endif() endif()
if(MSVC) if(MSVC OR IOS)
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
if(IOS)
set(CPACK_ARCHIVE_FILE_EXTENSION ".ipa")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
endif()
elseif(APPLE AND NOT IOS) elseif(APPLE AND NOT IOS)
set(CPACK_GENERATOR DragNDrop) set(CPACK_GENERATOR DragNDrop)
elseif(VITA) elseif(VITA)

View File

@ -6,12 +6,7 @@ If you feel fit to contribute, feel free to create a pull request! Someone will
Please keep your pull requests small and understandable; you may be able to shoot ahead and make a lot of progress in a short amount of time, but this is a collaborative project, so you must allow others to catch up and follow along. Large pull requests become significantly more unwieldy to review, and as such make it exponentially more likely for a mistake or error to go undetected. They also make it harder to merge other pull requests because the more files you modify, the more likely it is for a merge conflict to occur. A general guideline is to keep submissions limited to one class at a time. Sometimes two or more classes may be too interlinked for this to be feasible, so this is not a hard rule, however if your PR is starting to modify more than 10 or so files, it's probably getting too big. Please keep your pull requests small and understandable; you may be able to shoot ahead and make a lot of progress in a short amount of time, but this is a collaborative project, so you must allow others to catch up and follow along. Large pull requests become significantly more unwieldy to review, and as such make it exponentially more likely for a mistake or error to go undetected. They also make it harder to merge other pull requests because the more files you modify, the more likely it is for a merge conflict to occur. A general guideline is to keep submissions limited to one class at a time. Sometimes two or more classes may be too interlinked for this to be feasible, so this is not a hard rule, however if your PR is starting to modify more than 10 or so files, it's probably getting too big.
This repository has a single goal: achieving platform independence. Consequently, contributions that do not support this goal cannot be accepted. Examples of out-of-scope contributions include: This repository has achieving platform independence as its primary goal, with limited support for light modding (using [`extensions`](/extensions)). Any changes that modify code in `LEGO1` are unlikely to be accepted, unless they directly serve to increase platform compatibility.
* Improving code efficiency or performance without addressing platform compatibility
* Replacing `MxString` with `std::string`
* Fixing gameplay bugs
* Enhancing audio or video quality
If in doubt, please contact us in the [Matrix chatroom](https://matrix.to/#/#isledecomp:matrix.org). If in doubt, please contact us in the [Matrix chatroom](https://matrix.to/#/#isledecomp:matrix.org).

25
ISLE/ios/config.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "config.h"
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_log.h>
#include <iniparser.h>
void IOS_SetupDefaultConfigOverrides(dictionary* p_dictionary)
{
SDL_Log("Overriding default config for iOS");
// Use DevelopmentFiles path for disk and cd paths
// It's good to use that path since user can easily
// connect through SMB and copy the files
const char* documentFolder = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS);
char* diskPath = new char[strlen(documentFolder) + strlen("isle") + 1]();
strcpy(diskPath, documentFolder);
strcat(diskPath, "isle");
if (!SDL_GetPathInfo(diskPath, NULL)) {
SDL_CreateDirectory(diskPath);
}
iniparser_set(p_dictionary, "isle:diskpath", diskPath);
iniparser_set(p_dictionary, "isle:cdpath", diskPath);
}

8
ISLE/ios/config.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef IOS_CONFIG_H
#define IOS_CONFIG_H
#include "dictionary.h"
void IOS_SetupDefaultConfigOverrides(dictionary* p_dictionary);
#endif // IOS_CONFIG_H

View File

@ -37,6 +37,7 @@
#include "tgl/d3drm/impl.h" #include "tgl/d3drm/impl.h"
#include "viewmanager/viewmanager.h" #include "viewmanager/viewmanager.h"
#include <extensions/extensions.h>
#include <miniwin/miniwindevice.h> #include <miniwin/miniwindevice.h>
#define SDL_MAIN_USE_CALLBACKS #define SDL_MAIN_USE_CALLBACKS
@ -63,6 +64,10 @@
#include "xbox_one_series/config.h" #include "xbox_one_series/config.h"
#endif #endif
#ifdef IOS
#include "ios/config.h"
#endif
#ifdef __vita__ #ifdef __vita__
#include "vita/config.h" #include "vita/config.h"
#include "vita/messagebox.h" #include "vita/messagebox.h"
@ -107,6 +112,7 @@ MxFloat g_lastJoystickMouseX = 0;
MxFloat g_lastJoystickMouseY = 0; MxFloat g_lastJoystickMouseY = 0;
MxFloat g_lastMouseX = 320; MxFloat g_lastMouseX = 320;
MxFloat g_lastMouseY = 240; MxFloat g_lastMouseY = 240;
MxBool g_mouseWarped = FALSE;
bool g_dpadUp = false; bool g_dpadUp = false;
bool g_dpadDown = false; bool g_dpadDown = false;
@ -623,6 +629,10 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
break; break;
} }
case SDL_EVENT_MOUSE_MOTION: case SDL_EVENT_MOUSE_MOTION:
if (g_mouseWarped) {
g_mouseWarped = FALSE;
break;
}
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
if (detectedTouchEvents) { if (detectedTouchEvents) {
break; break;
@ -640,8 +650,13 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
); );
} }
if (g_isle->GetDrawCursor()) { g_lastMouseX = event->motion.x;
VideoManager()->MoveCursor(Min((MxS32) event->motion.x, 639), Min((MxS32) event->motion.y, 479)); g_lastMouseY = event->motion.y;
SDL_ShowCursor();
g_isle->SetDrawCursor(FALSE);
if (VideoManager()) {
VideoManager()->SetCursorBitmap(NULL);
} }
break; break;
case SDL_EVENT_FINGER_MOTION: { case SDL_EVENT_FINGER_MOTION: {
@ -657,8 +672,13 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
InputManager()->QueueEvent(c_notificationMouseMove, LegoEventNotificationParam::c_lButtonState, x, y, 0); InputManager()->QueueEvent(c_notificationMouseMove, LegoEventNotificationParam::c_lButtonState, x, y, 0);
} }
if (g_isle->GetDrawCursor()) { g_lastMouseX = x;
VideoManager()->MoveCursor(Min((MxS32) x, 639), Min((MxS32) y, 479)); g_lastMouseY = y;
SDL_HideCursor();
g_isle->SetDrawCursor(FALSE);
if (VideoManager()) {
VideoManager()->SetCursorBitmap(NULL);
} }
break; break;
} }
@ -692,6 +712,15 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
if (InputManager()) { if (InputManager()) {
InputManager()->QueueEvent(c_notificationButtonDown, LegoEventNotificationParam::c_lButtonState, x, y, 0); InputManager()->QueueEvent(c_notificationButtonDown, LegoEventNotificationParam::c_lButtonState, x, y, 0);
} }
g_lastMouseX = x;
g_lastMouseY = y;
SDL_HideCursor();
g_isle->SetDrawCursor(FALSE);
if (VideoManager()) {
VideoManager()->SetCursorBitmap(NULL);
}
break; break;
} }
case SDL_EVENT_MOUSE_BUTTON_UP: case SDL_EVENT_MOUSE_BUTTON_UP:
@ -828,12 +857,9 @@ MxResult IsleApp::SetupWindow()
m_cursorBusy = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT); m_cursorBusy = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT);
m_cursorNo = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NOT_ALLOWED); m_cursorNo = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NOT_ALLOWED);
SDL_SetCursor(m_cursorCurrent); SDL_SetCursor(m_cursorCurrent);
if (g_isle->GetDrawCursor()) { m_cursorCurrentBitmap = m_cursorArrowBitmap = &arrow_cursor;
SDL_HideCursor(); m_cursorBusyBitmap = &busy_cursor;
m_cursorCurrentBitmap = m_cursorArrowBitmap = &arrow_cursor; m_cursorNoBitmap = &no_cursor;
m_cursorBusyBitmap = &busy_cursor;
m_cursorNoBitmap = &no_cursor;
}
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, g_targetWidth); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, g_targetWidth);
@ -917,7 +943,7 @@ MxResult IsleApp::SetupWindow()
LegoOmni::GetInstance()->GetInputManager()->SetUseJoystick(m_useJoystick); LegoOmni::GetInstance()->GetInputManager()->SetUseJoystick(m_useJoystick);
LegoOmni::GetInstance()->GetInputManager()->SetJoystickIndex(m_joystickIndex); LegoOmni::GetInstance()->GetInputManager()->SetJoystickIndex(m_joystickIndex);
} }
if (LegoOmni::GetInstance()->GetVideoManager() && g_isle->GetDrawCursor()) { if (LegoOmni::GetInstance()->GetVideoManager()) {
LegoOmni::GetInstance()->GetVideoManager()->SetCursorBitmap(m_cursorCurrentBitmap); LegoOmni::GetInstance()->GetVideoManager()->SetCursorBitmap(m_cursorCurrentBitmap);
} }
MxDirect3D* d3d = LegoOmni::GetInstance()->GetVideoManager()->GetDirect3D(); MxDirect3D* d3d = LegoOmni::GetInstance()->GetVideoManager()->GetDirect3D();
@ -941,7 +967,11 @@ MxResult IsleApp::SetupWindow()
// FUNCTION: ISLE 0x4028d0 // FUNCTION: ISLE 0x4028d0
bool IsleApp::LoadConfig() bool IsleApp::LoadConfig()
{ {
#ifdef IOS
const char* prefPath = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS);
#else
char* prefPath = SDL_GetPrefPath("isledecomp", "isle"); char* prefPath = SDL_GetPrefPath("isledecomp", "isle");
#endif
char* iniConfig; char* iniConfig;
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
@ -1006,7 +1036,6 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false"); iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false");
iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_joystickIndex, buf, 10)); iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_joystickIndex, buf, 10));
iniparser_set(dict, "isle:Draw Cursor", m_drawCursor ? "true" : "false");
SDL_snprintf(buf, sizeof(buf), "%f", m_cursorSensitivity); SDL_snprintf(buf, sizeof(buf), "%f", m_cursorSensitivity);
iniparser_set(dict, "isle:Cursor Sensitivity", buf); iniparser_set(dict, "isle:Cursor Sensitivity", buf);
@ -1019,12 +1048,22 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:Max Allowed Extras", SDL_itoa(m_maxAllowedExtras, buf, 10)); iniparser_set(dict, "isle:Max Allowed Extras", SDL_itoa(m_maxAllowedExtras, buf, 10));
iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10)); iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10));
#ifdef EXTENSIONS
iniparser_set(dict, "extensions", NULL);
for (const char* key : Extensions::availableExtensions) {
iniparser_set(dict, key, "false");
}
#endif
#ifdef __3DS__ #ifdef __3DS__
N3DS_SetupDefaultConfigOverrides(dict); N3DS_SetupDefaultConfigOverrides(dict);
#endif #endif
#ifdef WINDOWS_STORE #ifdef WINDOWS_STORE
XBONE_SetupDefaultConfigOverrides(dict); XBONE_SetupDefaultConfigOverrides(dict);
#endif #endif
#ifdef IOS
IOS_SetupDefaultConfigOverrides(dict);
#endif
#ifdef __vita__ #ifdef __vita__
VITA_SetupDefaultConfigOverrides(dict); VITA_SetupDefaultConfigOverrides(dict);
#endif #endif
@ -1058,7 +1097,6 @@ bool IsleApp::LoadConfig()
m_useMusic = iniparser_getboolean(dict, "isle:Music", m_useMusic); m_useMusic = iniparser_getboolean(dict, "isle:Music", m_useMusic);
m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick); m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick);
m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex); m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex);
m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor);
m_cursorSensitivity = iniparser_getdouble(dict, "isle:Cursor Sensitivity", m_cursorSensitivity); m_cursorSensitivity = iniparser_getdouble(dict, "isle:Cursor Sensitivity", m_cursorSensitivity);
MxS32 backBuffersInVRAM = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", -1); MxS32 backBuffersInVRAM = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", -1);
@ -1096,9 +1134,23 @@ bool IsleApp::LoadConfig()
m_savePath = new char[strlen(savePath) + 1]; m_savePath = new char[strlen(savePath) + 1];
strcpy(m_savePath, savePath); strcpy(m_savePath, savePath);
#ifdef EXTENSIONS
std::vector<const char*> keys;
keys.resize(iniparser_getsecnkeys(dict, "extensions"));
iniparser_getseckeys(dict, "extensions", keys.data());
for (const char* key : keys) {
if (iniparser_getboolean(dict, key, 0)) {
Extensions::Enable(key);
}
}
#endif
iniparser_freedict(dict); iniparser_freedict(dict);
delete[] iniConfig; delete[] iniConfig;
#ifndef IOS
SDL_free(prefPath); SDL_free(prefPath);
#endif
return true; return true;
} }
@ -1227,12 +1279,7 @@ void IsleApp::SetupCursor(Cursor p_cursor)
} }
if (g_isle->GetDrawCursor()) { if (g_isle->GetDrawCursor()) {
if (m_cursorCurrentBitmap == NULL) { VideoManager()->SetCursorBitmap(m_cursorCurrentBitmap);
VideoManager()->SetCursorBitmap(NULL);
}
else {
VideoManager()->SetCursorBitmap(m_cursorCurrentBitmap);
}
} }
else { else {
if (m_cursorCurrent != NULL) { if (m_cursorCurrent != NULL) {
@ -1406,8 +1453,18 @@ void IsleApp::MoveVirtualMouseViaJoystick()
); );
} }
if (g_isle->GetDrawCursor()) { SDL_HideCursor();
g_isle->SetDrawCursor(TRUE);
if (VideoManager()) {
VideoManager()->SetCursorBitmap(m_cursorCurrentBitmap);
VideoManager()->MoveCursor(Min((MxS32) g_lastMouseX, 639), Min((MxS32) g_lastMouseY, 479)); VideoManager()->MoveCursor(Min((MxS32) g_lastMouseX, 639), Min((MxS32) g_lastMouseY, 479));
} }
IDirect3DRMMiniwinDevice* device = GetD3DRMMiniwinDevice();
if (device) {
Sint32 x, y;
device->ConvertRenderToWindowCoordinates(g_lastMouseX, g_lastMouseY, x, y);
g_mouseWarped = TRUE;
SDL_WarpMouseInWindow(window, x, y);
}
} }
} }

View File

@ -56,6 +56,7 @@ class IsleApp {
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; } void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; } void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
void SetDrawCursor(MxS32 p_drawCursor) { m_drawCursor = p_drawCursor; }
MxResult ParseArguments(int argc, char** argv); MxResult ParseArguments(int argc, char** argv);
MxResult VerifyFilesystem(); MxResult VerifyFilesystem();

View File

@ -37,7 +37,7 @@ bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, con
init_result = (SceCommonDialogErrorCode) sceMsgDialogInit(&param); init_result = (SceCommonDialogErrorCode) sceMsgDialogInit(&param);
if (init_result >= 0) { if (init_result >= 0) {
while (sceMsgDialogGetStatus() == SCE_COMMON_DIALOG_STATUS_RUNNING) { while (sceMsgDialogGetStatus() == SCE_COMMON_DIALOG_STATUS_RUNNING) {
gxm->clear(0, 0, 1, true); gxm->clear(0, 0, 0, true);
gxm->swap_display(); gxm->swap_display();
} }
SDL_zero(dialog_result); SDL_zero(dialog_result);

View File

@ -1,5 +1,6 @@
#include "legotextureinfo.h" #include "legotextureinfo.h"
#include "extensions/textureloader.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "misc.h" #include "misc.h"
#include "misc/legoimage.h" #include "misc/legoimage.h"
@ -9,6 +10,8 @@
DECOMP_SIZE_ASSERT(LegoTextureInfo, 0x10) DECOMP_SIZE_ASSERT(LegoTextureInfo, 0x10)
using namespace Extensions;
// FUNCTION: LEGO1 0x10065bf0 // FUNCTION: LEGO1 0x10065bf0
LegoTextureInfo::LegoTextureInfo() LegoTextureInfo::LegoTextureInfo()
{ {
@ -56,6 +59,10 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text
strcpy(textureInfo->m_name, p_name); strcpy(textureInfo->m_name, p_name);
} }
if (Extension<TextureLoader>::Call(PatchTexture, textureInfo).value_or(false)) {
return textureInfo;
}
LPDIRECTDRAW pDirectDraw = VideoManager()->GetDirect3D()->DirectDraw(); LPDIRECTDRAW pDirectDraw = VideoManager()->GetDirect3D()->DirectDraw();
LegoImage* image = p_texture->GetImage(); LegoImage* image = p_texture->GetImage();

View File

@ -4,7 +4,7 @@
This initiative is a portable version of LEGO Island (Version 1.1, English) based on the [decompilation project](https://github.com/isledecomp/isle). Our primary goal is to transform the codebase to achieve platform independence, thereby enhancing compatibility across various systems while preserving the original game's experience as faithfully as possible. This initiative is a portable version of LEGO Island (Version 1.1, English) based on the [decompilation project](https://github.com/isledecomp/isle). Our primary goal is to transform the codebase to achieve platform independence, thereby enhancing compatibility across various systems while preserving the original game's experience as faithfully as possible.
Please note: this project is dedicated to achieving platform independence without altering the core gameplay, adding new features, enhancing visual quality, or rewriting code for improvement's sake. While those are worthwhile objectives, they are not within the scope of this project. Please note: this project is primarily dedicated to achieving platform independence without altering the core gameplay or rewriting code for improvement's sake. While those are worthwhile objectives, they are not within the scope of this project. `isle-portable` offers support for light modding using [`extensions`](/extensions).
## Status ## Status
@ -16,10 +16,10 @@ Please note: this project is dedicated to achieving platform independence withou
| [Web](https://isle.pizza) | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) | | [Web](https://isle.pizza) | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) |
| Nintendo 3DS | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) | | Nintendo 3DS | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) |
| Xbox One | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) | | Xbox One | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) |
| iOS | [![CI](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml/badge.svg)](https://github.com/isledecomp/isle-portable/actions/workflows/ci.yml) |
We are actively working to support more platforms. If you have experience with a particular platform, we encourage you to contribute to `isle-portable`. You can find a [list of ongoing efforts](https://github.com/isledecomp/isle-portable/wiki/Work%E2%80%90in%E2%80%90progress-ports) in our Wiki. We are actively working to support more platforms. If you have experience with a particular platform, we encourage you to contribute to `isle-portable`. You can find a [list of ongoing efforts](https://github.com/isledecomp/isle-portable/wiki/Work%E2%80%90in%E2%80%90progress-ports) in our Wiki.
## Usage ## Usage
**An existing copy of LEGO Island is required to use this project.** **An existing copy of LEGO Island is required to use this project.**

View File

@ -28,6 +28,7 @@ COPY --chown=emscripten:emscripten miniwin/ ./miniwin/
COPY --chown=emscripten:emscripten util/ ./util/ COPY --chown=emscripten:emscripten util/ ./util/
COPY --chown=emscripten:emscripten CMake/ ./CMake/ COPY --chown=emscripten:emscripten CMake/ ./CMake/
COPY --chown=emscripten:emscripten packaging/ ./packaging/ COPY --chown=emscripten:emscripten packaging/ ./packaging/
COPY --chown=emscripten:emscripten extensions/ ./extensions/
COPY --chown=emscripten:emscripten CMakeLists.txt . COPY --chown=emscripten:emscripten CMakeLists.txt .
RUN emcmake cmake -S . -B build -DISLE_BUILD_CONFIG=OFF -DISLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release -DISLE_EMSCRIPTEN_HOST=/assets && \ RUN emcmake cmake -S . -B build -DISLE_BUILD_CONFIG=OFF -DISLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release -DISLE_EMSCRIPTEN_HOST=/assets && \

View File

@ -0,0 +1,28 @@
#pragma once
#include "lego1_export.h"
#include <functional>
#include <optional>
#include <string>
namespace Extensions
{
constexpr const char* availableExtensions[] = {"extensions:texture loader"};
LEGO1_EXPORT void Enable(const char* p_key);
template <typename T>
struct Extension {
template <typename Function, typename... Args>
static auto Call(Function&& function, Args&&... args) -> std::optional<std::invoke_result_t<Function, Args...>>
{
#ifdef EXTENSIONS
if (T::enabled) {
return std::invoke(std::forward<Function>(function), std::forward<Args>(args)...);
}
#endif
return std::nullopt;
}
};
}; // namespace Extensions

View File

@ -0,0 +1,24 @@
#pragma once
#include "extensions/extensions.h"
#include "legotextureinfo.h"
namespace Extensions
{
class TextureLoader {
public:
static bool PatchTexture(LegoTextureInfo* p_textureInfo);
static bool enabled;
private:
static constexpr const char* texturePath = "/textures/";
static SDL_Surface* FindTexture(const char* p_name);
};
#ifdef EXTENSIONS
constexpr auto PatchTexture = &TextureLoader::PatchTexture;
#else
constexpr decltype(&TextureLoader::PatchTexture) PatchTexture = nullptr;
#endif
}; // namespace Extensions

View File

@ -0,0 +1,19 @@
#include "extensions/extensions.h"
#include "extensions/textureloader.h"
#include <SDL3/SDL_log.h>
void Extensions::Enable(const char* p_key)
{
for (const char* key : availableExtensions) {
if (!SDL_strcasecmp(p_key, key)) {
if (!SDL_strcasecmp(p_key, "extensions:texture loader")) {
TextureLoader::enabled = true;
}
SDL_Log("Enabled extension: %s", p_key);
break;
}
}
}

View File

@ -0,0 +1,101 @@
#include "extensions/textureloader.h"
using namespace Extensions;
bool TextureLoader::enabled = false;
bool TextureLoader::PatchTexture(LegoTextureInfo* p_textureInfo)
{
SDL_Surface* surface = FindTexture(p_textureInfo->m_name);
if (!surface) {
return false;
}
const SDL_PixelFormatDetails* details = SDL_GetPixelFormatDetails(surface->format);
DDSURFACEDESC desc;
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
desc.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY;
desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat);
desc.dwWidth = surface->w;
desc.dwHeight = surface->h;
desc.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
desc.ddpfPixelFormat.dwRGBBitCount = details->bits_per_pixel;
desc.ddpfPixelFormat.dwRBitMask = details->Rmask;
desc.ddpfPixelFormat.dwGBitMask = details->Gmask;
desc.ddpfPixelFormat.dwBBitMask = details->Bmask;
desc.ddpfPixelFormat.dwRGBAlphaBitMask = details->Amask;
LPDIRECTDRAW pDirectDraw = VideoManager()->GetDirect3D()->DirectDraw();
if (pDirectDraw->CreateSurface(&desc, &p_textureInfo->m_surface, NULL) != DD_OK) {
SDL_DestroySurface(surface);
return false;
}
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
if (p_textureInfo->m_surface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY, NULL) != DD_OK) {
SDL_DestroySurface(surface);
return false;
}
MxU8* dst = (MxU8*) desc.lpSurface;
Uint8* srcPixels = (Uint8*) surface->pixels;
if (details->bits_per_pixel == 8) {
SDL_Palette* sdlPalette = SDL_GetSurfacePalette(surface);
if (!sdlPalette) {
SDL_DestroySurface(surface);
return false;
}
PALETTEENTRY entries[256];
for (int i = 0; i < sdlPalette->ncolors; ++i) {
entries[i].peRed = sdlPalette->colors[i].r;
entries[i].peGreen = sdlPalette->colors[i].g;
entries[i].peBlue = sdlPalette->colors[i].b;
entries[i].peFlags = PC_NONE;
}
LPDIRECTDRAWPALETTE ddPalette = nullptr;
if (pDirectDraw->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256, entries, &ddPalette, NULL) != DD_OK) {
SDL_DestroySurface(surface);
return false;
}
p_textureInfo->m_surface->SetPalette(ddPalette);
ddPalette->Release();
}
memcpy(dst, srcPixels, surface->pitch * surface->h);
p_textureInfo->m_surface->Unlock(desc.lpSurface);
p_textureInfo->m_palette = NULL;
if (((TglImpl::RendererImpl*) VideoManager()->GetRenderer())
->CreateTextureFromSurface(p_textureInfo->m_surface, &p_textureInfo->m_texture) != D3DRM_OK) {
SDL_DestroySurface(surface);
return false;
}
p_textureInfo->m_texture->SetAppData((LPD3DRM_APPDATA) p_textureInfo);
SDL_DestroySurface(surface);
return true;
}
SDL_Surface* TextureLoader::FindTexture(const char* p_name)
{
SDL_Surface* surface;
MxString path = MxString(MxOmni::GetHD()) + texturePath + p_name + ".bmp";
path.MapPathToFilesystem();
if (!(surface = SDL_LoadBMP(path.GetData()))) {
path = MxString(MxOmni::GetCD()) + texturePath + p_name + ".bmp";
path.MapPathToFilesystem();
surface = SDL_LoadBMP(path.GetData());
}
return surface;
}

View File

@ -19,6 +19,7 @@ add_library(miniwin STATIC EXCLUDE_FROM_ALL
src/d3drm/d3drmmesh.cpp src/d3drm/d3drmmesh.cpp
src/d3drm/d3drmtexture.cpp src/d3drm/d3drmtexture.cpp
src/d3drm/d3drmviewport.cpp src/d3drm/d3drmviewport.cpp
src/d3drm/d3drmrenderer.cpp
src/internal/meshutils.cpp src/internal/meshutils.cpp
) )
@ -49,7 +50,7 @@ if(NOT (VITA OR WINDOWS_STORE))
target_sources(miniwin PRIVATE src/d3drm/backends/opengles2/renderer.cpp) target_sources(miniwin PRIVATE src/d3drm/backends/opengles2/renderer.cpp)
list(APPEND GRAPHICS_BACKENDS USE_OPENGLES2) list(APPEND GRAPHICS_BACKENDS USE_OPENGLES2)
if(OPENGL_ES2_LIBRARY) if(OPENGL_ES2_LIBRARY)
target_link_libraries(miniwin PRIVATE ${OPENGL_ES2_LIBRARY}) target_link_libraries(miniwin PRIVATE ${OPENGL_ES2_LIBRARY})
endif() endif()
else() else()
message(STATUS "🧩 OpenGL ES 2.x support not enabled") message(STATUS "🧩 OpenGL ES 2.x support not enabled")

View File

@ -6,4 +6,5 @@ DEFINE_GUID(IID_IDirect3DRMMiniwinDevice, 0x6eb09673, 0x8d30, 0x4d8a, 0x8d, 0x81
struct IDirect3DRMMiniwinDevice : virtual public IUnknown { struct IDirect3DRMMiniwinDevice : virtual public IUnknown {
virtual bool ConvertEventToRenderCoordinates(SDL_Event* event) = 0; virtual bool ConvertEventToRenderCoordinates(SDL_Event* event) = 0;
virtual bool ConvertRenderToWindowCoordinates(Sint32 inX, Sint32 inY, Sint32& outX, Sint32& outY) = 0;
}; };

View File

@ -7,27 +7,6 @@
#include "d3drmmesh_impl.h" #include "d3drmmesh_impl.h"
#include "d3drmobject_impl.h" #include "d3drmobject_impl.h"
#include "d3drmrenderer.h" #include "d3drmrenderer.h"
#ifdef USE_OPENGL1
#include "d3drmrenderer_opengl1.h"
#endif
#ifdef USE_OPENGLES2
#include "d3drmrenderer_opengles2.h"
#endif
#ifdef USE_CITRO3D
#include "d3drmrenderer_citro3d.h"
#endif
#ifdef USE_DIRECTX9
#include "d3drmrenderer_directx9.h"
#endif
#ifdef USE_GXM
#include "d3drmrenderer_gxm.h"
#endif
#ifdef USE_SDL_GPU
#include "d3drmrenderer_sdl3gpu.h"
#endif
#ifdef USE_SOFTWARE_RENDER
#include "d3drmrenderer_software.h"
#endif
#include "d3drmtexture_impl.h" #include "d3drmtexture_impl.h"
#include "d3drmviewport_impl.h" #include "d3drmviewport_impl.h"
#include "ddraw_impl.h" #include "ddraw_impl.h"
@ -153,44 +132,8 @@ HRESULT Direct3DRMImpl::CreateDeviceFromSurface(
DDSDesc.dwSize = sizeof(DDSURFACEDESC); DDSDesc.dwSize = sizeof(DDSURFACEDESC);
surface->GetSurfaceDesc(&DDSDesc); surface->GetSurfaceDesc(&DDSDesc);
if (false) { DDRenderer = CreateDirect3DRMRenderer(DDSDesc, guid);
} if (!DDRenderer) {
#ifdef USE_SDL_GPU
else if (SDL_memcmp(&guid, &SDL3_GPU_GUID, sizeof(GUID)) == 0) {
DDRenderer = Direct3DRMSDL3GPURenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_SOFTWARE_RENDER
else if (SDL_memcmp(&guid, &SOFTWARE_GUID, sizeof(GUID)) == 0) {
DDRenderer = new Direct3DRMSoftwareRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_OPENGLES2
else if (SDL_memcmp(&guid, &OpenGLES2_GUID, sizeof(GUID)) == 0) {
DDRenderer = OpenGLES2Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_OPENGL1
else if (SDL_memcmp(&guid, &OpenGL1_GUID, sizeof(GUID)) == 0) {
DDRenderer = OpenGL1Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_CITRO3D
else if (SDL_memcmp(&guid, &Citro3D_GUID, sizeof(GUID)) == 0) {
DDRenderer = new Citro3DRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_DIRECTX9
else if (SDL_memcmp(&guid, &DirectX9_GUID, sizeof(GUID)) == 0) {
DDRenderer = DirectX9Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_GXM
else if (SDL_memcmp(&guid, &GXM_GUID, sizeof(GUID)) == 0) {
DDRenderer = GXMRenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Device GUID not recognized"); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Device GUID not recognized");
return E_NOINTERFACE; return E_NOINTERFACE;
} }

View File

@ -198,3 +198,11 @@ bool Direct3DRMDevice2Impl::ConvertEventToRenderCoordinates(SDL_Event* event)
return true; return true;
} }
bool Direct3DRMDevice2Impl::ConvertRenderToWindowCoordinates(Sint32 inX, Sint32 inY, Sint32& outX, Sint32& outY)
{
outX = static_cast<Sint32>(inX * m_viewportTransform.scale + m_viewportTransform.offsetX);
outY = static_cast<Sint32>(inY * m_viewportTransform.scale + m_viewportTransform.offsetY);
return true;
}

View File

@ -0,0 +1,87 @@
#include "d3drmrenderer.h"
#ifdef USE_OPENGL1
#include "d3drmrenderer_opengl1.h"
#endif
#ifdef USE_OPENGLES2
#include "d3drmrenderer_opengles2.h"
#endif
#ifdef USE_CITRO3D
#include "d3drmrenderer_citro3d.h"
#endif
#ifdef USE_DIRECTX9
#include "d3drmrenderer_directx9.h"
#endif
#ifdef USE_SDL_GPU
#include "d3drmrenderer_sdl3gpu.h"
#endif
#ifdef USE_SOFTWARE_RENDER
#include "d3drmrenderer_software.h"
#endif
#ifdef USE_GXM
#include "d3drmrenderer_gxm.h"
#endif
Direct3DRMRenderer* CreateDirect3DRMRenderer(const DDSURFACEDESC& DDSDesc, const GUID* guid)
{
#ifdef USE_SDL_GPU
if (SDL_memcmp(guid, &SDL3_GPU_GUID, sizeof(GUID)) == 0) {
return Direct3DRMSDL3GPURenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_SOFTWARE_RENDER
if (SDL_memcmp(guid, &SOFTWARE_GUID, sizeof(GUID)) == 0) {
return new Direct3DRMSoftwareRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_OPENGLES2
if (SDL_memcmp(guid, &OpenGLES2_GUID, sizeof(GUID)) == 0) {
return OpenGLES2Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_OPENGL1
if (SDL_memcmp(guid, &OpenGL1_GUID, sizeof(GUID)) == 0) {
return OpenGL1Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_CITRO3D
if (SDL_memcmp(guid, &Citro3D_GUID, sizeof(GUID)) == 0) {
return new Citro3DRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_DIRECTX9
if (SDL_memcmp(guid, &DirectX9_GUID, sizeof(GUID)) == 0) {
return DirectX9Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_GXM
if (SDL_memcmp(guid, &GXM_GUID, sizeof(GUID)) == 0) {
return GXMRenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
return nullptr;
}
void Direct3DRMRenderer_EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
{
#ifdef USE_SDL_GPU
Direct3DRMSDL3GPU_EnumDevice(cb, ctx);
#endif
#ifdef USE_OPENGLES2
OpenGLES2Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_OPENGL1
OpenGL1Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_CITRO3D
Citro3DRenderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_DIRECTX9
DirectX9Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_SOFTWARE_RENDER
Direct3DRMSoftware_EnumDevice(cb, ctx);
#endif
#ifdef USE_GXM
GXMRenderer_EnumDevice(cb, ctx);
#endif
}

View File

@ -1,24 +1,5 @@
#ifdef USE_OPENGL1
#include "d3drmrenderer_opengl1.h" #include "d3drmrenderer.h"
#endif
#ifdef USE_OPENGLES2
#include "d3drmrenderer_opengles2.h"
#endif
#ifdef USE_CITRO3D
#include "d3drmrenderer_citro3d.h"
#endif
#if USE_DIRECTX9
#include "d3drmrenderer_directx9.h"
#endif
#ifdef USE_GXM
#include "d3drmrenderer_gxm.h"
#endif
#ifdef USE_SDL_GPU
#include "d3drmrenderer_sdl3gpu.h"
#endif
#ifdef USE_SOFTWARE_RENDER
#include "d3drmrenderer_software.h"
#endif
#include "ddpalette_impl.h" #include "ddpalette_impl.h"
#include "ddraw_impl.h" #include "ddraw_impl.h"
#include "ddsurface_impl.h" #include "ddsurface_impl.h"
@ -239,27 +220,7 @@ void EnumDevice(
HRESULT DirectDrawImpl::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx) HRESULT DirectDrawImpl::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
{ {
#ifdef USE_SDL_GPU Direct3DRMRenderer_EnumDevices(cb, ctx);
Direct3DRMSDL3GPU_EnumDevice(cb, ctx);
#endif
#ifdef USE_OPENGLES2
OpenGLES2Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_OPENGL1
OpenGL1Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_CITRO3D
Citro3DRenderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_DIRECTX9
DirectX9Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_GXM
GXMRenderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_SOFTWARE_RENDER
Direct3DRMSoftware_EnumDevice(cb, ctx);
#endif
return S_OK; return S_OK;
} }
@ -356,44 +317,8 @@ HRESULT DirectDrawImpl::CreateDevice(
DDSDesc.dwSize = sizeof(DDSURFACEDESC); DDSDesc.dwSize = sizeof(DDSURFACEDESC);
pBackBuffer->GetSurfaceDesc(&DDSDesc); pBackBuffer->GetSurfaceDesc(&DDSDesc);
if (false) { DDRenderer = CreateDirect3DRMRenderer(DDSDesc, &guid);
} if (!DDRenderer) {
#ifdef USE_SDL_GPU
else if (SDL_memcmp(&guid, &SDL3_GPU_GUID, sizeof(GUID)) == 0) {
DDRenderer = Direct3DRMSDL3GPURenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_OPENGLES2
else if (SDL_memcmp(&guid, &OpenGLES2_GUID, sizeof(GUID)) == 0) {
DDRenderer = OpenGLES2Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_OPENGL1
else if (SDL_memcmp(&guid, &OpenGL1_GUID, sizeof(GUID)) == 0) {
DDRenderer = OpenGL1Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef __3DS__
else if (SDL_memcmp(&guid, &Citro3D_GUID, sizeof(GUID)) == 0) {
DDRenderer = new Citro3DRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_DIRECTX9
else if (SDL_memcmp(&guid, &DirectX9_GUID, sizeof(GUID)) == 0) {
DDRenderer = DirectX9Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_GXM
else if (SDL_memcmp(&guid, &GXM_GUID, sizeof(GUID)) == 0) {
DDRenderer = GXMRenderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_SOFTWARE_RENDER
else if (SDL_memcmp(&guid, &SOFTWARE_GUID, sizeof(GUID)) == 0) {
DDRenderer = new Direct3DRMSoftwareRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Device GUID not recognized"); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Device GUID not recognized");
return E_NOINTERFACE; return E_NOINTERFACE;
} }

View File

@ -34,6 +34,7 @@ struct Direct3DRMDevice2Impl : public Direct3DRMObjectBaseImpl<IDirect3DRMDevice
// IDirect3DRMMiniwinDevice interface // IDirect3DRMMiniwinDevice interface
bool ConvertEventToRenderCoordinates(SDL_Event* event) override; bool ConvertEventToRenderCoordinates(SDL_Event* event) override;
bool ConvertRenderToWindowCoordinates(Sint32 inX, Sint32 inY, Sint32& outX, Sint32& outY) override;
Direct3DRMRenderer* m_renderer; Direct3DRMRenderer* m_renderer;

View File

@ -60,3 +60,6 @@ class Direct3DRMRenderer : public IDirect3DDevice2 {
int m_virtualWidth, m_virtualHeight; int m_virtualWidth, m_virtualHeight;
ViewportTransform m_viewportTransform; ViewportTransform m_viewportTransform;
}; };
Direct3DRMRenderer* CreateDirect3DRMRenderer(const DDSURFACEDESC& DDSDesc, const GUID* guid);
void Direct3DRMRenderer_EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx);

View File

@ -28,3 +28,7 @@ endif()
if(APPLE AND NOT IOS) if(APPLE AND NOT IOS)
add_subdirectory(macos) add_subdirectory(macos)
endif() endif()
if(IOS)
add_subdirectory(ios)
endif()

View File

@ -0,0 +1,52 @@
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${APP_ID})
set(MACOSX_BUNDLE_COPYRIGHT ${APP_SPDX})
set(ISLE_TARGET_NAME isle)
set(MACOSX_ISLE_BUNDLE_NAME ${APP_NAME}) # Do note that it can be up to 15 characters long
set(MACOSX_ISLE_BUNDLE_DISPLAY_NAME ${APP_NAME})
set(MACOSX_BUNDLE_INFO_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${PROJECT_VERSION}")
set(MACOSX_BUNDLE_REQUIRED_PLATFORM IPhoneOS)
if(ISLE_BUILD_APP)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/isle/Info.plist.in"
"${CMAKE_CURRENT_BINARY_DIR}/isle/Info.plist"
@ONLY
)
set(RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/isle/LaunchScreen.storyboard" "${CMAKE_CURRENT_SOURCE_DIR}/isle/Assets.xcassets")
target_sources(${ISLE_TARGET_NAME} PRIVATE ${RESOURCE_FILES})
set_source_files_properties(${RESOURCE_FILES}
TARGET_DIRECTORY isle
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(${ISLE_TARGET_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/isle/Info.plist"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
install(TARGETS ${ISLE_TARGET_NAME} DESTINATION ./)
install(CODE "
file(COPY
\"\$<TARGET_FILE:SDL3::SDL3>\"
\"\$<TARGET_FILE:lego1>\"
DESTINATION \"\$\{CMAKE_INSTALL_PREFIX\}/${ISLE_TARGET_NAME}.app/Frameworks\")
execute_process(COMMAND /usr/bin/install_name_tool
-add_rpath @executable_path/Frameworks
\"\$\{CMAKE_INSTALL_PREFIX\}/${ISLE_TARGET_NAME}.app/${ISLE_TARGET_NAME}\"
)
file(MAKE_DIRECTORY
\"\$\{CMAKE_INSTALL_PREFIX\}/Payload\")
file(RENAME
\"\$\{CMAKE_INSTALL_PREFIX\}/${ISLE_TARGET_NAME}.app\"
\"\$\{CMAKE_INSTALL_PREFIX\}/Payload/${ISLE_TARGET_NAME}.app\")
")
endif()
install(CODE "
if(IS_DIRECTORY \"\$\{CMAKE_INSTALL_PREFIX\}/bin\" OR IS_DIRECTORY \"\$\{CMAKE_INSTALL_PREFIX\}/lib\" OR EXISTS \"\$\{CMAKE_INSTALL_PREFIX\}/AppIcon.icns\")
execute_process(COMMAND /bin/rm
-rf \"\$\{CMAKE_INSTALL_PREFIX\}/bin\" \"\$\{CMAKE_INSTALL_PREFIX\}/lib\" \"\$\{CMAKE_INSTALL_PREFIX\}/AppIcon.icns\"
)
endif()
")

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,36 @@
{
"images" : [
{
"filename" : "AppIcon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>@MACOSX_BUNDLE_INFO_STRING@</string>
<key>CFBundleIdentifier</key>
<string>@MACOSX_BUNDLE_GUI_IDENTIFIER@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>@MACOSX_BUNDLE_LONG_VERSION_STRING@</string>
<key>CFBundleName</key>
<string>@MACOSX_ISLE_BUNDLE_NAME@</string>
<key>CFBundleDisplayName</key>
<string>@MACOSX_ISLE_BUNDLE_DISPLAY_NAME@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@MACOSX_BUNDLE_SHORT_VERSION_STRING@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@MACOSX_BUNDLE_BUNDLE_VERSION@</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequires@MACOSX_BUNDLE_REQUIRED_PLATFORM@</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>@MACOSX_BUNDLE_COPYRIGHT@</string>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
<string>resource</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
</dict>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24093.7" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24053.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="0.0" y="832" width="393" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="285" width="393" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -55,6 +55,11 @@
"path": "../../../miniwin", "path": "../../../miniwin",
"dest": "miniwin/" "dest": "miniwin/"
}, },
{
"type": "dir",
"path": "../../../extensions",
"dest": "extensions/"
},
{ {
"type": "dir", "type": "dir",
"path": "../../../packaging", "path": "../../../packaging",