Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Nokia N-Gage: add frame
Browse files Browse the repository at this point in the history
  • Loading branch information
mupfdev committed Oct 15, 2022
1 parent 284d3fe commit 6c0739c
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 103 deletions.
203 changes: 106 additions & 97 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,113 @@
{
"configurations": [
"configurations": [
{
"name": "x64 (Debug)",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "x64 (Debug)",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "SDL2_INCLUDE_DIR",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\include",
"type": "PATH"
},
{
"name": "SDL2_LIBRARY",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\lib\\x64\\SDL2.lib",
"type": "FILEPATH"
},
{
"name": "NGAGE_DEBUG",
"value": "True",
"type": "BOOL"
},
{
"name": "CELESTE_P8_FIXEDP",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_HACKED_BALLOONS",
"value": "False",
"type": "BOOL"
}
]
"name": "SDL2_INCLUDE_DIR",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\include",
"type": "PATH"
},
{
"name": "x64 (Release)",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "SDL2_INCLUDE_DIR",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\include",
"type": "PATH"
},
{
"name": "SDL2_LIBRARY",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\lib\\x64\\SDL2.lib",
"type": "FILEPATH"
},
{
"name": "NGAGE_DEBUG",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_FIXEDP",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_HACKED_BALLOONS",
"value": "False",
"type": "BOOL"
}
]
"name": "SDL2_LIBRARY",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\lib\\x64\\SDL2.lib",
"type": "FILEPATH"
},
{
"name": "N-Gage",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DBUILD_FOR_NOKIA_NGAGE=ON",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "INSTALL_EKA2L1",
"value": "True",
"type": "BOOL"
},
{
"name": "GENERATE_SIS",
"value": "True",
"type": "BOOL"
}
]
"name": "NGAGE_DEBUG",
"value": "True",
"type": "BOOL"
},
{
"name": "CELESTE_P8_FIXEDP",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_HACKED_BALLOONS",
"value": "False",
"type": "BOOL"
}
]
},
{
"name": "x64 (Release)",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "SDL2_INCLUDE_DIR",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\include",
"type": "PATH"
},
{
"name": "SDL2_LIBRARY",
"value": "${projectDir}\\deps\\SDL2-2.24.0_x64\\lib\\x64\\SDL2.lib",
"type": "FILEPATH"
},
{
"name": "NGAGE_DEBUG",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_FIXEDP",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_HACKED_BALLOONS",
"value": "False",
"type": "BOOL"
}
]
},
{
"name": "N-Gage",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DBUILD_FOR_NOKIA_NGAGE=ON",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "INSTALL_EKA2L1",
"value": "True",
"type": "BOOL"
},
{
"name": "GENERATE_SIS",
"value": "True",
"type": "BOOL"
},
{
"name": "CELESTE_P8_FIXEDP",
"value": "False",
"type": "BOOL"
},
{
"name": "CELESTE_P8_HACKED_BALLOONS",
"value": "False",
"type": "BOOL"
}
]
}

]
}
]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@ Sound wave files are taken from the
project, music *.ogg files were obtained by converting the *.wav dumps
from PICO-8, which I did using audacity & ffmpeg.

The frame for the N-Gage version is based on [Mountain at Dusk
Background](https://opengameart.org/content/mountain-at-dusk-background)
by ansimuz.

All credit for the original game goes to the original developers (Maddy
Thorson & Noel Berry).
3 changes: 1 addition & 2 deletions cmake/Nokia_N-Gage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ if(INSTALL_EKA2L1)
copy_file(game.exe ${CMAKE_CURRENT_BINARY_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME} game.exe)
copy_file(game.exe ${DATA_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME}/data font.bmp)
copy_file(game.exe ${DATA_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME}/data gfx.bmp)
copy_file(game.exe ${DATA_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME}/data frame.bmp)
copy_file_ex(launcher.app ${CMAKE_CURRENT_BINARY_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME} launcher.app ${APP_NAME}.app)
copy_file_ex(launcher.rsc ${CMAKE_CURRENT_BINARY_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME} launcher.rsc ${APP_NAME}.rsc)
copy_file_ex(launcher.aif ${CMAKE_CURRENT_BINARY_DIR} ${EKA2L1_E_DRIVE}/System/Apps/${APP_NAME} launcher.aif ${APP_NAME}.aif)
endif()

if(GENERATE_SIS)
copy_file(game.exe ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/sis game.exe)
copy_file(game.exe ${DATA_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/sis font.bmp)
copy_file(game.exe ${DATA_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/sis gfx.bmp)
copy_file_ex(launcher.app ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/sis launcher.app ${APP_NAME}.app)
copy_file_ex(launcher.rsc ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/sis launcher.rsc ${APP_NAME}.rsc)
copy_file_ex(launcher.aif ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/sis launcher.aif ${APP_NAME}.aif)
Expand Down
1 change: 1 addition & 0 deletions cmake/project_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/font.bmp ${CMAKE_CUR
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/gfx.bmp ${CMAKE_CURRENT_SOURCE_DIR}/export/data COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/test-tas.txt ${CMAKE_CURRENT_SOURCE_DIR}/export COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/gamecontrollerdb.txt ${CMAKE_CURRENT_SOURCE_DIR}/export COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/frame.bmp ${CMAKE_CURRENT_SOURCE_DIR}/export COPYONLY)

if(CELESTE_P8_FIXEDP)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/src/celeste.c PROPERTIES LANGUAGE CXX )
Expand Down
Binary file added data/frame.bmp
Binary file not shown.
7 changes: 4 additions & 3 deletions res/launcher.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
&EN

; standard SIS file header
#{"Celeste"},(0x10005731),1,0,0
#{"Celeste"},(0x10005731),1,1,0

;Supports Series 60 v 0.9
(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
Expand All @@ -14,5 +14,6 @@
"..\sis\Celeste.aif"-"E:\System\Apps\Celeste\Celeste.aif"
"..\sis\Celeste.app"-"E:\System\Apps\Celeste\Celeste.app"
"..\sis\Celeste.rsc"-"E:\System\Apps\Celeste\Celeste.rsc"
"..\sis\font.bmp"-"E:\System\Apps\Celeste\data\font.bmp"
"..\sis\gfx.bmp"-"E:\System\Apps\Celeste\data\gfx.bmp"
"..\data\font.bmp"-"E:\System\Apps\Celeste\data\font.bmp"
"..\data\gfx.bmp"-"E:\System\Apps\Celeste\data\gfx.bmp"
"..\data\frame.bmp"-"E:\System\Apps\Celeste\data\frame.bmp"
48 changes: 47 additions & 1 deletion src/sdl20compat.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ static SDL_Texture* sdl2_screen_tex = NULL;
static SDL_Window* sdl2_window = NULL;
static SDL_Renderer* sdl2_rendr = NULL;

#if defined (__NGAGE__) || defined (NGAGE_DEBUG)
static SDL_Texture* ngage_frame = NULL;
#endif

static SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
Expand Down Expand Up @@ -55,6 +59,12 @@ static SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flag
if (0)
{
die:
#if defined (__NGAGE__) || defined (NGAGE_DEBUG)
if (ngage_frame)
{
SDL_DestroyTexture(ngage_frame);
}
#endif
if (sdl2_window)
{
SDL_DestroyWindow(sdl2_window);
Expand All @@ -72,6 +82,41 @@ static SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flag
}
sdl2_screen = SDL_CreateRGBSurface(0, width, height, 32, rmask, gmask, bmask, amask);
assert(sdl2_screen && sdl2_screen->format->BitsPerPixel == bpp);

#if defined (__NGAGE__) || defined (NGAGE_DEBUG)
{
#if defined (__NGAGE__)
SDL_Surface* frame_sf = SDL_LoadBMP("E:\\System\\Apps\\Celeste\\data\\frame.bmp");
#else
SDL_Surface* frame_sf = SDL_LoadBMP("frame.bmp");
#endif

if (! frame_sf)
{
SDL_Log("Failed to load image: %s", SDL_GetError());
}
else
{
if (0 != SDL_SetColorKey(frame_sf, SDL_TRUE, SDL_MapRGB(frame_sf->format, 0xff, 0x00, 0xff)))
{
SDL_Log("Failed to set color key for frame.bmp: %s", SDL_GetError());
}
if (0 != SDL_SetSurfaceRLE(frame_sf, 1))
{
SDL_Log("Could not enable RLE for surface frame.bmp: %s", SDL_GetError());
}

ngage_frame = SDL_CreateTextureFromSurface(sdl2_rendr, frame_sf);
if (! ngage_frame)
{
SDL_Log("Could not create texture from surface: %s", SDL_GetError());
}
}
SDL_FreeSurface(frame_sf);
SDL_RenderCopy(sdl2_rendr, ngage_frame, NULL, NULL);
SDL_RenderPresent(sdl2_rendr);
}
#endif
return sdl2_screen;
}

Expand Down Expand Up @@ -118,8 +163,9 @@ static void SDL_Flip(SDL_Surface* screen)
assert(sdl2_window != NULL);
SDL_UpdateTexture(sdl2_screen_tex, NULL, screen->pixels, screen->pitch);
SDL_SetRenderDrawColor(sdl2_rendr, 0, 0, 0, 255);
SDL_RenderClear(sdl2_rendr);
//SDL_RenderClear(sdl2_rendr);
#if defined (__NGAGE__) || defined (NGAGE_DEBUG)
// SDL_RenderCopy(sdl2_rendr, ngage_frame, NULL, NULL);
SDL_RenderCopy(sdl2_rendr, sdl2_screen_tex, &source, &dest);
#else
SDL_RenderCopy(sdl2_rendr, sdl2_screen_tex, NULL, NULL);
Expand Down

0 comments on commit 6c0739c

Please sign in to comment.