mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 04:21:15 +00:00
This commit is contained in:
commit
9c60d84136
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
include:
|
||||
- { name: 'Linux', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: true, linux: true, werror: true, clang-tidy: true }
|
||||
- { name: 'MSVC (x86)', os: 'windows-latest', generator: 'Ninja', dx5: true, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_x86' }
|
||||
- { name: 'MSVC (x64)', os: 'windows-latest', generator: 'Ninja', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64' }
|
||||
- { name: 'MSVC (x64)', os: 'windows-latest', generator: 'Ninja', dx5: false, config: true, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64' }
|
||||
- { name: 'MSVC (arm64)', os: 'windows-latest', generator: 'Ninja', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_arm64' }
|
||||
- { 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}' }
|
||||
@ -62,6 +62,11 @@ jobs:
|
||||
${{ matrix.msys-env }}-ninja
|
||||
${{ matrix.msys-env }}-clang-tools-extra
|
||||
${{ (matrix.config && format('{0}-qt6-base', matrix.msys-env)) || '' }}
|
||||
- name: Install Qt
|
||||
if: ${{ !!matrix.msvc && matrix.config }}
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
cache: 'true'
|
||||
|
||||
- name: Install Linux dependencies (apt-get)
|
||||
if: ${{ matrix.linux }}
|
||||
|
||||
@ -704,6 +704,25 @@ install(TARGETS isle ${install_extra_targets}
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
if (ISLE_BUILD_CONFIG)
|
||||
if(WIN32)
|
||||
find_program(WINDEPLOYQT_EXECUTABLE windeployqt)
|
||||
if(WINDEPLOYQT_EXECUTABLE)
|
||||
install(CODE "message(STATUS \"Running windeployqt with minimal dependencies\")
|
||||
execute_process(COMMAND \"${WINDEPLOYQT_EXECUTABLE}\"
|
||||
\"$<TARGET_FILE:isle-config>\"
|
||||
--dir QTLibs
|
||||
--no-compiler-runtime
|
||||
--no-opengl-sw
|
||||
--no-system-d3d-compiler
|
||||
--no-translations
|
||||
--no-quick-import
|
||||
)"
|
||||
)
|
||||
install(DIRECTORY "Build/QTLibs/" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
else()
|
||||
message(STATUS "windeployqt not found: Qt binaries will not be installed")
|
||||
endif()
|
||||
endif()
|
||||
install(TARGETS isle-config
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
|
||||
@ -97,10 +97,10 @@ MxS32 g_targetDepth = 16;
|
||||
// GLOBAL: ISLE 0x410064
|
||||
MxS32 g_reqEnableRMDevice = FALSE;
|
||||
|
||||
float g_lastJoystickMouseX = 0;
|
||||
float g_lastJoystickMouseY = 0;
|
||||
float g_lastMouseX = 0;
|
||||
float g_lastMouseY = 0;
|
||||
MxFloat g_lastJoystickMouseX = 0;
|
||||
MxFloat g_lastJoystickMouseY = 0;
|
||||
MxFloat g_lastMouseX = 0;
|
||||
MxFloat g_lastMouseY = 0;
|
||||
|
||||
// STRING: ISLE 0x4101dc
|
||||
#define WINDOW_TITLE "LEGO®"
|
||||
@ -161,7 +161,7 @@ IsleApp::IsleApp()
|
||||
m_maxLod = RealtimeView::GetUserMaxLOD();
|
||||
m_maxAllowedExtras = m_islandQuality <= 1 ? 10 : 20;
|
||||
m_transitionType = MxTransitionManager::e_mosaic;
|
||||
m_mouseSensitivity = 4;
|
||||
m_cursorSensitivity = 4;
|
||||
}
|
||||
|
||||
// FUNCTION: ISLE 0x4011a0
|
||||
@ -283,7 +283,7 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv)
|
||||
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
|
||||
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
||||
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) {
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD)) {
|
||||
char buffer[256];
|
||||
SDL_snprintf(
|
||||
buffer,
|
||||
@ -393,26 +393,7 @@ SDL_AppResult SDL_AppIterate(void* appstate)
|
||||
g_mousemoved = FALSE;
|
||||
}
|
||||
|
||||
if (g_lastJoystickMouseX != 0 || g_lastJoystickMouseY != 0) {
|
||||
g_mousemoved = TRUE;
|
||||
|
||||
g_lastMouseX = SDL_clamp(g_lastMouseX + g_lastJoystickMouseX, 0, 640);
|
||||
g_lastMouseY = SDL_clamp(g_lastMouseY + g_lastJoystickMouseY, 0, 480);
|
||||
|
||||
if (InputManager()) {
|
||||
InputManager()->QueueEvent(
|
||||
c_notificationMouseMove,
|
||||
g_mousedown ? LegoEventNotificationParam::c_lButtonState : 0,
|
||||
g_lastMouseX,
|
||||
g_lastMouseY,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
if (g_isle->GetDrawCursor()) {
|
||||
VideoManager()->MoveCursor(Min((MxS32) g_lastMouseX, 639), Min((MxS32) g_lastMouseY, 479));
|
||||
}
|
||||
}
|
||||
g_isle->MoveVirtualMouseViaJoystick();
|
||||
}
|
||||
|
||||
return SDL_APP_CONTINUE;
|
||||
@ -491,14 +472,14 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_JOYSTICK_BUTTON_DOWN: {
|
||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN: {
|
||||
{
|
||||
if (event->gbutton.button == ISLE_BUTTON_SPACE) {
|
||||
if (event->gbutton.button == SDL_GAMEPAD_BUTTON_SOUTH) {
|
||||
if (InputManager()) {
|
||||
InputManager()->QueueEvent(c_notificationKeyPress, SDLK_SPACE, 0, 0, SDLK_SPACE);
|
||||
}
|
||||
}
|
||||
if (event->gbutton.button == ISLE_BUTTON_ESCAPE) {
|
||||
if (event->gbutton.button == SDL_GAMEPAD_BUTTON_START) {
|
||||
if (InputManager()) {
|
||||
InputManager()->QueueEvent(c_notificationKeyPress, SDLK_ESCAPE, 0, 0, SDLK_ESCAPE);
|
||||
}
|
||||
@ -506,20 +487,20 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_JOYSTICK_AXIS_MOTION: {
|
||||
if (event->gaxis.axis == ISLE_MOUSE_JOYSTICK_X) {
|
||||
g_lastJoystickMouseX = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||
case SDL_EVENT_GAMEPAD_AXIS_MOTION: {
|
||||
MxS16 axisValue = 0;
|
||||
if (event->gaxis.value < -8000 || event->gaxis.value > 8000) {
|
||||
// Ignore small axis values
|
||||
axisValue = event->gaxis.value;
|
||||
}
|
||||
else if (event->gaxis.axis == ISLE_MOUSE_JOYSTICK_Y) {
|
||||
#ifdef WINDOWS_STORE
|
||||
g_lastJoystickMouseY =
|
||||
-((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||
#else
|
||||
g_lastJoystickMouseY = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||
#endif
|
||||
if (event->gaxis.axis == SDL_GAMEPAD_AXIS_RIGHTX) {
|
||||
g_lastJoystickMouseX = ((MxFloat) axisValue) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetCursorSensitivity();
|
||||
}
|
||||
else if (event->gaxis.axis == ISLE_MOUSE_CLICK_AXIS) {
|
||||
if (event->gaxis.value != SDL_JOYSTICK_AXIS_MIN) {
|
||||
else if (event->gaxis.axis == SDL_GAMEPAD_AXIS_RIGHTY) {
|
||||
g_lastJoystickMouseY = ((MxFloat) axisValue) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetCursorSensitivity();
|
||||
}
|
||||
else if (event->gaxis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
|
||||
if (axisValue != 0) {
|
||||
g_mousedown = TRUE;
|
||||
|
||||
if (InputManager()) {
|
||||
@ -933,8 +914,8 @@ bool IsleApp::LoadConfig()
|
||||
iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false");
|
||||
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_mouseSensitivity);
|
||||
iniparser_set(dict, "isle:Mouse Sensitivity", buf);
|
||||
SDL_snprintf(buf, sizeof(buf), "%f", m_cursorSensitivity);
|
||||
iniparser_set(dict, "isle:Cursor Sensitivity", buf);
|
||||
|
||||
iniparser_set(dict, "isle:Back Buffers in Video RAM", "-1");
|
||||
|
||||
@ -992,7 +973,7 @@ bool IsleApp::LoadConfig()
|
||||
m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick);
|
||||
m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex);
|
||||
m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor);
|
||||
m_mouseSensitivity = iniparser_getdouble(dict, "isle:Mouse Sensitivity", m_mouseSensitivity);
|
||||
m_cursorSensitivity = iniparser_getdouble(dict, "isle:Cursor Sensitivity", m_cursorSensitivity);
|
||||
|
||||
MxS32 backBuffersInVRAM = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", -1);
|
||||
if (backBuffersInVRAM != -1) {
|
||||
@ -1304,3 +1285,27 @@ IDirect3DRMMiniwinDevice* GetD3DRMMiniwinDevice()
|
||||
}
|
||||
return d3drmMiniwinDev;
|
||||
}
|
||||
|
||||
void IsleApp::MoveVirtualMouseViaJoystick()
|
||||
{
|
||||
if (g_lastJoystickMouseX != 0 || g_lastJoystickMouseY != 0) {
|
||||
g_mousemoved = TRUE;
|
||||
|
||||
g_lastMouseX = SDL_clamp(g_lastMouseX + g_lastJoystickMouseX, 0, 640);
|
||||
g_lastMouseY = SDL_clamp(g_lastMouseY + g_lastJoystickMouseY, 0, 480);
|
||||
|
||||
if (InputManager()) {
|
||||
InputManager()->QueueEvent(
|
||||
c_notificationMouseMove,
|
||||
g_mousedown ? LegoEventNotificationParam::c_lButtonState : 0,
|
||||
g_lastMouseX,
|
||||
g_lastMouseY,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
if (g_isle->GetDrawCursor()) {
|
||||
VideoManager()->MoveCursor(Min((MxS32) g_lastMouseX, 639), Min((MxS32) g_lastMouseY, 479));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class IsleApp {
|
||||
SDL_Cursor* GetCursorNo() { return m_cursorNo; }
|
||||
MxS32 GetDrawCursor() { return m_drawCursor; }
|
||||
MxS32 GetGameStarted() { return m_gameStarted; }
|
||||
MxFloat GetMouseSensitivity() { return m_mouseSensitivity; }
|
||||
MxFloat GetCursorSensitivity() { return m_cursorSensitivity; }
|
||||
|
||||
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
||||
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
||||
@ -60,6 +60,7 @@ class IsleApp {
|
||||
MxResult ParseArguments(int argc, char** argv);
|
||||
MxResult VerifyFilesystem();
|
||||
void DetectGameVersion();
|
||||
void MoveVirtualMouseViaJoystick();
|
||||
|
||||
private:
|
||||
char* m_hdPath; // 0x00
|
||||
@ -94,7 +95,7 @@ class IsleApp {
|
||||
const CursorBitmap* m_cursorNoBitmap;
|
||||
const CursorBitmap* m_cursorCurrentBitmap;
|
||||
char* m_mediaPath;
|
||||
MxFloat m_mouseSensitivity;
|
||||
MxFloat m_cursorSensitivity;
|
||||
|
||||
char* m_iniPath;
|
||||
MxFloat m_maxLod;
|
||||
|
||||
@ -166,7 +166,7 @@ class LegoInputManager : public MxPresenter {
|
||||
const bool* m_keyboardState;
|
||||
MxBool m_unk0x195; // 0x195
|
||||
SDL_JoystickID* m_joyids;
|
||||
SDL_Joystick* m_joystick;
|
||||
SDL_Gamepad* m_joystick;
|
||||
MxS32 m_joystickIndex; // 0x19c
|
||||
MxBool m_useJoystick; // 0x334
|
||||
MxBool m_unk0x335; // 0x335
|
||||
|
||||
@ -148,24 +148,28 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
|
||||
// FUNCTION: LEGO1 0x1005c240
|
||||
MxResult LegoInputManager::GetJoystick()
|
||||
{
|
||||
if (m_joystick != NULL && SDL_JoystickConnected(m_joystick) == TRUE) {
|
||||
if (m_joystick != NULL && SDL_GamepadConnected(m_joystick) == TRUE) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
MxS32 numJoysticks = 0;
|
||||
m_joyids = SDL_GetJoysticks(&numJoysticks);
|
||||
if (m_joyids != NULL) {
|
||||
SDL_free(m_joyids);
|
||||
m_joyids = NULL;
|
||||
}
|
||||
m_joyids = SDL_GetGamepads(&numJoysticks);
|
||||
|
||||
if (m_useJoystick != FALSE && numJoysticks != 0) {
|
||||
MxS32 joyid = m_joystickIndex;
|
||||
if (joyid >= 0) {
|
||||
m_joystick = SDL_OpenJoystick(m_joyids[joyid]);
|
||||
m_joystick = SDL_OpenGamepad(m_joyids[joyid]);
|
||||
if (m_joystick != NULL) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
for (joyid = 0; joyid < numJoysticks; joyid++) {
|
||||
m_joystick = SDL_OpenJoystick(m_joyids[joyid]);
|
||||
m_joystick = SDL_OpenGamepad(m_joyids[joyid]);
|
||||
if (m_joystick != NULL) {
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -182,59 +186,28 @@ MxResult LegoInputManager::GetJoystickState(MxU32* p_joystickX, MxU32* p_joystic
|
||||
if (GetJoystick() == -1) {
|
||||
if (m_joystick != NULL) {
|
||||
// GetJoystick() failed but handle to joystick is still open, close it
|
||||
SDL_CloseJoystick(m_joystick);
|
||||
SDL_CloseGamepad(m_joystick);
|
||||
m_joystick = NULL;
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_STORE
|
||||
MxS16 xPos = SDL_GetJoystickAxis(m_joystick, 1);
|
||||
MxS16 yPos = -SDL_GetJoystickAxis(m_joystick, 0);
|
||||
#else
|
||||
MxS16 xPos = SDL_GetJoystickAxis(m_joystick, 0);
|
||||
MxS16 yPos = SDL_GetJoystickAxis(m_joystick, 1);
|
||||
#endif
|
||||
MxU8 hatPos = SDL_GetJoystickHat(m_joystick, 0);
|
||||
MxS16 xPos = SDL_GetGamepadAxis(m_joystick, SDL_GAMEPAD_AXIS_LEFTX);
|
||||
MxS16 yPos = SDL_GetGamepadAxis(m_joystick, SDL_GAMEPAD_AXIS_LEFTY);
|
||||
if (xPos > -8000 && xPos < 8000) {
|
||||
// Ignore small axis values
|
||||
xPos = 0;
|
||||
}
|
||||
if (yPos > -8000 && yPos < 8000) {
|
||||
// Ignore small axis values
|
||||
yPos = 0;
|
||||
}
|
||||
|
||||
// normalize values acquired from joystick axes
|
||||
*p_joystickX = ((xPos + 32768) * 100) / 65535;
|
||||
*p_joystickY = ((yPos + 32768) * 100) / 65535;
|
||||
|
||||
switch (hatPos) {
|
||||
case SDL_HAT_CENTERED:
|
||||
*p_povPosition = (MxU32) -1;
|
||||
break;
|
||||
case SDL_HAT_UP:
|
||||
*p_povPosition = (MxU32) 0;
|
||||
break;
|
||||
case SDL_HAT_RIGHT:
|
||||
*p_povPosition = (MxU32) 9000 / 100;
|
||||
break;
|
||||
case SDL_HAT_DOWN:
|
||||
*p_povPosition = (MxU32) 18000 / 100;
|
||||
break;
|
||||
case SDL_HAT_LEFT:
|
||||
*p_povPosition = (MxU32) 27000 / 100;
|
||||
break;
|
||||
case SDL_HAT_RIGHTUP:
|
||||
*p_povPosition = (MxU32) 4500 / 100;
|
||||
break;
|
||||
case SDL_HAT_RIGHTDOWN:
|
||||
*p_povPosition = (MxU32) 13500 / 100;
|
||||
break;
|
||||
case SDL_HAT_LEFTUP:
|
||||
*p_povPosition = (MxU32) 31500 / 100;
|
||||
break;
|
||||
case SDL_HAT_LEFTDOWN:
|
||||
*p_povPosition = (MxU32) 22500 / 100;
|
||||
break;
|
||||
default:
|
||||
*p_povPosition = (MxU32) -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -409,9 +409,16 @@ void MxDisplaySurface::VTable0x28(
|
||||
return;
|
||||
}
|
||||
|
||||
DDCOLORKEY colorKey;
|
||||
colorKey.dwColorSpaceLowValue = colorKey.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f);
|
||||
tempSurface->SetColorKey(DDCKEY_SRCBLT, &colorKey);
|
||||
if (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount != 32) {
|
||||
DDCOLORKEY colorKey;
|
||||
if (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount == 8) {
|
||||
colorKey.dwColorSpaceLowValue = colorKey.dwColorSpaceHighValue = 0x10;
|
||||
}
|
||||
else {
|
||||
colorKey.dwColorSpaceLowValue = colorKey.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f);
|
||||
}
|
||||
tempSurface->SetColorKey(DDCKEY_SRCBLT, &colorKey);
|
||||
}
|
||||
|
||||
DDSURFACEDESC tempDesc;
|
||||
memset(&tempDesc, 0, sizeof(tempDesc));
|
||||
@ -503,29 +510,43 @@ void MxDisplaySurface::VTable0x30(
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS;
|
||||
ddsd.dwWidth = p_width;
|
||||
ddsd.dwHeight = p_height;
|
||||
ddsd.ddpfPixelFormat = m_surfaceDesc.ddpfPixelFormat;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
|
||||
HRESULT hr = m_ddSurface2->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL);
|
||||
if (hr == DDERR_SURFACELOST) {
|
||||
m_ddSurface2->Restore();
|
||||
hr = m_ddSurface2->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL);
|
||||
LPDIRECTDRAW draw = MVideoManager()->GetDirectDraw();
|
||||
LPDIRECTDRAWSURFACE tempSurface = nullptr;
|
||||
if (draw->CreateSurface(&ddsd, &tempSurface, nullptr) != DD_OK || !tempSurface) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hr != DD_OK) {
|
||||
DDCOLORKEY colorKey;
|
||||
colorKey.dwColorSpaceLowValue = colorKey.dwColorSpaceHighValue = 0;
|
||||
tempSurface->SetColorKey(DDCKEY_SRCBLT, &colorKey);
|
||||
|
||||
DDSURFACEDESC tempDesc;
|
||||
memset(&tempDesc, 0, sizeof(tempDesc));
|
||||
tempDesc.dwSize = sizeof(tempDesc);
|
||||
|
||||
if (tempSurface->Lock(NULL, &tempDesc, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) != DD_OK) {
|
||||
tempSurface->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
MxU8* data = p_bitmap->GetStart(p_left, p_top);
|
||||
|
||||
MxS32 bytesPerPixel = m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
MxU8* surface = (MxU8*) ddsd.lpSurface + (bytesPerPixel * p_right) + (p_bottom * ddsd.lPitch);
|
||||
MxU8* surface = (MxU8*) tempDesc.lpSurface;
|
||||
|
||||
if (p_RLE) {
|
||||
MxS32 size = p_bitmap->GetBmiHeader()->biSizeImage;
|
||||
DrawTransparentRLE(data, surface, size, p_width, p_height, ddsd.lPitch, bytesPerPixel * 8);
|
||||
DrawTransparentRLE(data, surface, size, p_width, p_height, tempDesc.lPitch, bytesPerPixel * 8);
|
||||
}
|
||||
else {
|
||||
MxLong stride = -p_width + GetAdjustedStride(p_bitmap);
|
||||
MxLong length = -bytesPerPixel * p_width + ddsd.lPitch;
|
||||
MxLong length = -bytesPerPixel * p_width + tempDesc.lPitch;
|
||||
|
||||
for (MxS32 i = 0; i < p_height; i++) {
|
||||
for (MxS32 j = 0; j < p_width; j++) {
|
||||
@ -550,7 +571,11 @@ void MxDisplaySurface::VTable0x30(
|
||||
}
|
||||
}
|
||||
|
||||
m_ddSurface2->Unlock(ddsd.lpSurface);
|
||||
tempSurface->Unlock(NULL);
|
||||
|
||||
m_ddSurface2->BltFast(p_right, p_bottom, tempSurface, NULL, DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY);
|
||||
|
||||
tempSurface->Release();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bb500
|
||||
|
||||
@ -1009,7 +1009,7 @@ void Direct3DRMSDL3GPURenderer::Download(SDL_Surface* target)
|
||||
}
|
||||
|
||||
SDL_Surface* renderedImage =
|
||||
SDL_CreateSurfaceFrom(width, height, SDL_PIXELFORMAT_ARGB8888, downloadedData, width * 4);
|
||||
SDL_CreateSurfaceFrom(width, height, SDL_PIXELFORMAT_XRGB8888, downloadedData, width * 4);
|
||||
|
||||
SDL_BlitSurfaceScaled(renderedImage, nullptr, target, nullptr, SDL_SCALEMODE_NEAREST);
|
||||
SDL_DestroySurface(renderedImage);
|
||||
|
||||
@ -761,10 +761,9 @@ void Direct3DRMSoftwareRenderer::Resize(int width, int height, const ViewportTra
|
||||
|
||||
void Direct3DRMSoftwareRenderer::Clear(float r, float g, float b)
|
||||
{
|
||||
SDL_Rect rect = {0, 0, m_renderedImage->w, m_renderedImage->h};
|
||||
const SDL_PixelFormatDetails* details = SDL_GetPixelFormatDetails(m_renderedImage->format);
|
||||
Uint32 color = SDL_MapRGB(details, m_palette, r * 255, g * 255, b * 255);
|
||||
SDL_FillSurfaceRect(m_renderedImage, &rect, color);
|
||||
SDL_FillSurfaceRect(m_renderedImage, nullptr, color);
|
||||
}
|
||||
|
||||
void Direct3DRMSoftwareRenderer::Flip()
|
||||
|
||||
@ -172,11 +172,10 @@ HRESULT FrameBufferImpl::Lock(LPRECT lpDestRect, DDSURFACEDESC* lpDDSurfaceDesc,
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
if ((dwFlags & DDLOCK_WRITEONLY) == DDLOCK_WRITEONLY) {
|
||||
SDL_Rect rect = {0, 0, m_transferBuffer->m_surface->w, m_transferBuffer->m_surface->h};
|
||||
const SDL_PixelFormatDetails* details = SDL_GetPixelFormatDetails(m_transferBuffer->m_surface->format);
|
||||
SDL_Palette* palette = m_palette ? static_cast<DirectDrawPaletteImpl*>(m_palette)->m_palette : nullptr;
|
||||
Uint32 color = SDL_MapRGBA(details, palette, 0, 0, 0, 0);
|
||||
SDL_FillSurfaceRect(m_transferBuffer->m_surface, &rect, color);
|
||||
SDL_FillSurfaceRect(m_transferBuffer->m_surface, nullptr, color);
|
||||
}
|
||||
else {
|
||||
DDRenderer->Download(m_transferBuffer->m_surface);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user