mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
-oneshot now writes to Software\\OneShot\\GameDirectory in registry the game's path
-journal now reads gamepath from registry to load images, instead of packing images into journal executable directly -also converted journal to a visual studio solution (for windows)
This commit is contained in:
parent
6b7e357e92
commit
42f3db8fb7
16 changed files with 361 additions and 240 deletions
7
journal/w32/.gitignore
vendored
Normal file
7
journal/w32/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.vs
|
||||
Debug
|
||||
journal/Debug
|
||||
!*.sln
|
||||
!*.vcxproj
|
||||
!*.vcxproj.filters
|
||||
!*.bmp
|
||||
31
journal/w32/journal.sln
Normal file
31
journal/w32/journal.sln
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30309.148
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "journal", "journal\journal.vcxproj", "{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Debug|x64.Build.0 = Debug|x64
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Debug|x86.Build.0 = Debug|Win32
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Release|x64.ActiveCfg = Release|x64
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Release|x64.Build.0 = Release|x64
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Release|x86.ActiveCfg = Release|Win32
|
||||
{0AC54FE5-AE4B-4B4F-9B06-2A29101AE745}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FE54145F-EE02-422A-BE71-80A6862C6C91}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
journal/w32/journal/img/default.bmp
Normal file
BIN
journal/w32/journal/img/default.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
BIN
journal/w32/journal/img/niko1.bmp
Normal file
BIN
journal/w32/journal/img/niko1.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
BIN
journal/w32/journal/img/niko2.bmp
Normal file
BIN
journal/w32/journal/img/niko2.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
BIN
journal/w32/journal/img/niko3.bmp
Normal file
BIN
journal/w32/journal/img/niko3.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
155
journal/w32/journal/journal.vcxproj
Normal file
155
journal/w32/journal/journal.vcxproj
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="src\icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\journal.c" />
|
||||
<ClCompile Include="src\main.c" />
|
||||
<ClCompile Include="src\niko.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="src\resources.rc" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{0ac54fe5-ae4b-4b4f-9b06-2a29101ae745}</ProjectGuid>
|
||||
<RootNamespace>journal</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
38
journal/w32/journal/journal.vcxproj.filters
Normal file
38
journal/w32/journal/journal.vcxproj.filters
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="src\icon.ico">
|
||||
<Filter>Source Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\journal.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\niko.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="src\resources.rc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
|
@ -1,5 +1,8 @@
|
|||
#define WINVER 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
// needed to suppress warnings about wcscpy and such
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <objbase.h>
|
||||
|
|
@ -8,6 +11,7 @@
|
|||
#define DEFAULT_WIDTH 800
|
||||
#define DEFAULT_HEIGHT 600
|
||||
#define IN_BUFFER_SIZE 256
|
||||
#define IMAGE_PATH_MAX_SIZE 512
|
||||
|
||||
#define WINDOW_STYLE (WS_OVERLAPPEDWINDOW ^ (WS_THICKFRAME | WS_MAXIMIZEBOX))
|
||||
|
||||
|
|
@ -20,25 +24,61 @@ static DWORD err = 0;
|
|||
|
||||
static HWND window = NULL;
|
||||
|
||||
static char DataPath[512];
|
||||
|
||||
static void loadImage(const char *name) {
|
||||
char copy_space[IN_BUFFER_SIZE];
|
||||
const char* lang_ptr;
|
||||
char imagePath[IMAGE_PATH_MAX_SIZE];
|
||||
|
||||
if (image_handle) {
|
||||
DeleteObject(image_handle);
|
||||
}
|
||||
image_handle = LoadBitmapA(GetModuleHandleW(NULL), name);
|
||||
// In the event we can't find an image's translated value
|
||||
// try to find a matching resource without any language code suffix
|
||||
if (!image_handle) {
|
||||
lang_ptr = strchr(name, '_');
|
||||
if (lang_ptr) {
|
||||
memset(copy_space, 0, IN_BUFFER_SIZE);
|
||||
strncpy(copy_space, name, lang_ptr - name);
|
||||
//terminate the string because I guess strncpy doesn't
|
||||
image_handle = LoadBitmapA(GetModuleHandleW(NULL), copy_space);
|
||||
if (!image_handle) {
|
||||
err = GetLastError();
|
||||
}
|
||||
|
||||
// handle default as a special case, since we'll keep that image internally
|
||||
if (strcmp(name, "default") == 0) {
|
||||
image_handle = LoadBitmapA(GetModuleHandleW(NULL), "default");
|
||||
}
|
||||
else {
|
||||
// names come in the format XX_YY
|
||||
// where XX is the image (ex: c1)
|
||||
// and YY is the lang code (ex: ja, or pt_br)
|
||||
// so let's separate this into 2 char pointers
|
||||
char imageName[IN_BUFFER_SIZE];
|
||||
char* langCode = 0;
|
||||
char* emptyString = "\0";
|
||||
strcpy(imageName, name);
|
||||
langCode = strchr(imageName, '_');
|
||||
if (langCode > 0) {
|
||||
// replace the code with 0 to null terminate the image name where this is
|
||||
// then use the rest of the string as the language code
|
||||
// so c1_ja becomes "c1\0ja", thus imageName is "c1" and then langCode is "ja"
|
||||
(*langCode) = 0;
|
||||
langCode++;
|
||||
}
|
||||
else {
|
||||
langCode = emptyString;
|
||||
}
|
||||
|
||||
// build imagePath
|
||||
strcpy(imagePath, DataPath);
|
||||
strcat(imagePath, "Graphics\\Journal\\");
|
||||
strcat(imagePath, langCode);
|
||||
strcat(imagePath, "\\");
|
||||
strcat(imagePath, imageName);
|
||||
strcat(imagePath, ".bmp");
|
||||
|
||||
image_handle = LoadImageA(NULL, imagePath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||
// In the event we can't find an image's translated value
|
||||
// try to find a matching file in the root folder
|
||||
if (!image_handle) {
|
||||
// build imagePath
|
||||
strcpy(imagePath, DataPath);
|
||||
strcat(imagePath, "Graphics\\Journal\\");
|
||||
strcat(imagePath, imageName);
|
||||
strcat(imagePath, ".bmp");
|
||||
image_handle = LoadImageA(NULL, imagePath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||
if (!image_handle) {
|
||||
err = GetLastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -146,11 +186,34 @@ void init_check_save(WCHAR* save_path) {
|
|||
}
|
||||
}
|
||||
|
||||
// images should be loaded from gamepath folder
|
||||
// so we need a gamepath, which should be saved in the registry
|
||||
boolean readGamePath() {
|
||||
// clear data path
|
||||
memset(&DataPath[0], 0, sizeof(DataPath));
|
||||
DWORD dataPathSize = sizeof(DataPath);
|
||||
|
||||
HKEY key;
|
||||
long keyOpenError = RegOpenKey(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), &key);
|
||||
|
||||
if (keyOpenError == ERROR_SUCCESS) {
|
||||
long dirReadError = RegQueryValueEx(key, TEXT("GameDirectory"), NULL, NULL, (LPBYTE)DataPath, &dataPathSize);
|
||||
|
||||
RegCloseKey(key);
|
||||
|
||||
return dirReadError == ERROR_SUCCESS;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int do_journal()
|
||||
{
|
||||
// Create
|
||||
HINSTANCE module = GetModuleHandleW(NULL);
|
||||
|
||||
// load data path from registry
|
||||
readGamePath();
|
||||
|
||||
// Default image
|
||||
WCHAR save_path[MAX_PATH];
|
||||
PWSTR folder_path = NULL;
|
||||
9
journal/w32/journal/src/resources.rc
Normal file
9
journal/w32/journal/src/resources.rc
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include <winuser.h>
|
||||
MAINICON ICON "icon.ico"
|
||||
|
||||
NIKO1 BITMAP "img/NIKO1.bmp"
|
||||
NIKO2 BITMAP "img/NIKO2.bmp"
|
||||
NIKO3 BITMAP "img/NIKO3.bmp"
|
||||
|
||||
default BITMAP "img/DEFAULT.bmp"
|
||||
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
#include <winuser.h>
|
||||
MAINICON ICON "icon.ico"
|
||||
|
||||
NIKO1 BITMAP "img/NIKO1.bmp"
|
||||
NIKO2 BITMAP "img/NIKO2.bmp"
|
||||
NIKO3 BITMAP "img/NIKO3.bmp"
|
||||
|
||||
default BITMAP "img/DEFAULT.bmp"
|
||||
t1 BITMAP "img/T1.bmp"
|
||||
t2 BITMAP "img/T2.bmp"
|
||||
t3 BITMAP "img/T3.bmp"
|
||||
t4 BITMAP "img/T4.bmp"
|
||||
t5 BITMAP "img/T5.bmp"
|
||||
t6 BITMAP "img/T6.bmp"
|
||||
t7 BITMAP "img/T7.bmp"
|
||||
t8 BITMAP "img/T8.bmp"
|
||||
t9 BITMAP "img/T9.bmp"
|
||||
t10 BITMAP "img/T10.bmp"
|
||||
t11 BITMAP "img/T11.bmp"
|
||||
t12 BITMAP "img/T12.bmp"
|
||||
t13 BITMAP "img/T13.bmp"
|
||||
t14 BITMAP "img/T14.bmp"
|
||||
t15 BITMAP "img/T15.bmp"
|
||||
t16 BITMAP "img/T16.bmp"
|
||||
c1 BITMAP "img/C1.bmp"
|
||||
c2 BITMAP "img/C2.bmp"
|
||||
c3 BITMAP "img/C3.bmp"
|
||||
c4 BITMAP "img/C4.bmp"
|
||||
c5 BITMAP "img/C5.bmp"
|
||||
c6 BITMAP "img/C6.bmp"
|
||||
c7 BITMAP "img/C7.bmp"
|
||||
s1 BITMAP "img/S1.bmp"
|
||||
s2 BITMAP "img/S2.bmp"
|
||||
s3 BITMAP "img/S3.bmp"
|
||||
s4 BITMAP "img/S4.bmp"
|
||||
save BITMAP "img/SAVE.bmp"
|
||||
final BITMAP "img/FINAL.bmp"
|
||||
|
||||
//french
|
||||
t1_FR BITMAP "img/fr/T1.bmp"
|
||||
t2_FR BITMAP "img/fr/T2.bmp"
|
||||
t3_FR BITMAP "img/fr/T3.bmp"
|
||||
t4_FR BITMAP "img/fr/T4.bmp"
|
||||
t5_FR BITMAP "img/fr/T5.bmp"
|
||||
t6_FR BITMAP "img/fr/T6.bmp"
|
||||
t7_FR BITMAP "img/fr/T7.bmp"
|
||||
t8_FR BITMAP "img/fr/T8.bmp"
|
||||
t9_FR BITMAP "img/fr/T9.bmp"
|
||||
t10_FR BITMAP "img/fr/T10.bmp"
|
||||
t11_FR BITMAP "img/fr/T11.bmp"
|
||||
t12_FR BITMAP "img/fr/T12.bmp"
|
||||
t13_FR BITMAP "img/fr/T13.bmp"
|
||||
t14_FR BITMAP "img/fr/T14.bmp"
|
||||
t15_FR BITMAP "img/fr/T15.bmp"
|
||||
t16_FR BITMAP "img/fr/T16.bmp"
|
||||
c1_FR BITMAP "img/fr/C1.bmp"
|
||||
c2_FR BITMAP "img/fr/C2.bmp"
|
||||
c3_FR BITMAP "img/fr/C3.bmp"
|
||||
c4_FR BITMAP "img/fr/C4.bmp"
|
||||
c5_FR BITMAP "img/fr/C5.bmp"
|
||||
c6_FR BITMAP "img/fr/C6.bmp"
|
||||
c7_FR BITMAP "img/fr/C7.bmp"
|
||||
s1_FR BITMAP "img/fr/S1.bmp"
|
||||
s2_FR BITMAP "img/fr/S2.bmp"
|
||||
s3_FR BITMAP "img/fr/S3.bmp"
|
||||
s4_FR BITMAP "img/fr/S4.bmp"
|
||||
save_FR BITMAP "img/fr/SAVE.bmp"
|
||||
final_FR BITMAP "img/fr/FINAL.bmp"
|
||||
|
||||
//spanish
|
||||
t1_ES BITMAP "img/es/T1.bmp"
|
||||
t2_ES BITMAP "img/es/T2.bmp"
|
||||
t3_ES BITMAP "img/es/T3.bmp"
|
||||
t4_ES BITMAP "img/es/T4.bmp"
|
||||
t5_ES BITMAP "img/es/T5.bmp"
|
||||
t6_ES BITMAP "img/es/T6.bmp"
|
||||
t7_ES BITMAP "img/es/T7.bmp"
|
||||
t8_ES BITMAP "img/es/T8.bmp"
|
||||
t9_ES BITMAP "img/es/T9.bmp"
|
||||
t10_ES BITMAP "img/es/T10.bmp"
|
||||
t11_ES BITMAP "img/es/T11.bmp"
|
||||
t12_ES BITMAP "img/es/T12.bmp"
|
||||
t13_ES BITMAP "img/es/T13.bmp"
|
||||
t14_ES BITMAP "img/es/T14.bmp"
|
||||
t15_ES BITMAP "img/es/T15.bmp"
|
||||
t16_ES BITMAP "img/es/T16.bmp"
|
||||
c1_ES BITMAP "img/es/C1.bmp"
|
||||
c2_ES BITMAP "img/es/C2.bmp"
|
||||
c3_ES BITMAP "img/es/C3.bmp"
|
||||
c4_ES BITMAP "img/es/C4.bmp"
|
||||
c5_ES BITMAP "img/es/C5.bmp"
|
||||
c6_ES BITMAP "img/es/C6.bmp"
|
||||
c7_ES BITMAP "img/es/C7.bmp"
|
||||
s1_ES BITMAP "img/es/S1.bmp"
|
||||
s2_ES BITMAP "img/es/S2.bmp"
|
||||
s3_ES BITMAP "img/es/S3.bmp"
|
||||
s4_ES BITMAP "img/es/S4.bmp"
|
||||
save_ES BITMAP "img/es/SAVE.bmp"
|
||||
final_ES BITMAP "img/es/FINAL.bmp"
|
||||
|
||||
//japanese
|
||||
t1_JA BITMAP "img/ja/T1.bmp"
|
||||
t2_JA BITMAP "img/ja/T2.bmp"
|
||||
t3_JA BITMAP "img/ja/T3.bmp"
|
||||
t4_JA BITMAP "img/ja/T4.bmp"
|
||||
t5_JA BITMAP "img/ja/T5.bmp"
|
||||
t6_JA BITMAP "img/ja/T6.bmp"
|
||||
t7_JA BITMAP "img/ja/T7.bmp"
|
||||
t8_JA BITMAP "img/ja/T8.bmp"
|
||||
t9_JA BITMAP "img/ja/T9.bmp"
|
||||
t10_JA BITMAP "img/ja/T10.bmp"
|
||||
t11_JA BITMAP "img/ja/T11.bmp"
|
||||
t12_JA BITMAP "img/ja/T12.bmp"
|
||||
t13_JA BITMAP "img/ja/T13.bmp"
|
||||
t14_JA BITMAP "img/ja/T14.bmp"
|
||||
t15_JA BITMAP "img/ja/T15.bmp"
|
||||
t16_JA BITMAP "img/ja/T16.bmp"
|
||||
c1_JA BITMAP "img/ja/C1.bmp"
|
||||
c2_JA BITMAP "img/ja/C2.bmp"
|
||||
c3_JA BITMAP "img/ja/C3.bmp"
|
||||
c4_JA BITMAP "img/ja/C4.bmp"
|
||||
c5_JA BITMAP "img/ja/C5.bmp"
|
||||
c6_JA BITMAP "img/ja/C6.bmp"
|
||||
c7_JA BITMAP "img/ja/C7.bmp"
|
||||
s1_JA BITMAP "img/ja/S1.bmp"
|
||||
s2_JA BITMAP "img/ja/S2.bmp"
|
||||
s3_JA BITMAP "img/ja/S3.bmp"
|
||||
s4_JA BITMAP "img/ja/S4.bmp"
|
||||
save_JA BITMAP "img/ja/SAVE.bmp"
|
||||
final_JA BITMAP "img/ja/FINAL.bmp"
|
||||
|
||||
//korean
|
||||
t1_KO BITMAP "img/ko/T1.bmp"
|
||||
t2_KO BITMAP "img/ko/T2.bmp"
|
||||
t3_KO BITMAP "img/ko/T3.bmp"
|
||||
t4_KO BITMAP "img/ko/T4.bmp"
|
||||
t5_KO BITMAP "img/ko/T5.bmp"
|
||||
t6_KO BITMAP "img/ko/T6.bmp"
|
||||
t7_KO BITMAP "img/ko/T7.bmp"
|
||||
t8_KO BITMAP "img/ko/T8.bmp"
|
||||
t9_KO BITMAP "img/ko/T9.bmp"
|
||||
t10_KO BITMAP "img/ko/T10.bmp"
|
||||
t11_KO BITMAP "img/ko/T11.bmp"
|
||||
t12_KO BITMAP "img/ko/T12.bmp"
|
||||
t13_KO BITMAP "img/ko/T13.bmp"
|
||||
t14_KO BITMAP "img/ko/T14.bmp"
|
||||
t15_KO BITMAP "img/ko/T15.bmp"
|
||||
t16_KO BITMAP "img/ko/T16.bmp"
|
||||
c1_KO BITMAP "img/ko/C1.bmp"
|
||||
c2_KO BITMAP "img/ko/C2.bmp"
|
||||
c3_KO BITMAP "img/ko/C3.bmp"
|
||||
c4_KO BITMAP "img/ko/C4.bmp"
|
||||
c5_KO BITMAP "img/ko/C5.bmp"
|
||||
c6_KO BITMAP "img/ko/C6.bmp"
|
||||
c7_KO BITMAP "img/ko/C7.bmp"
|
||||
s1_KO BITMAP "img/ko/S1.bmp"
|
||||
s2_KO BITMAP "img/ko/S2.bmp"
|
||||
s3_KO BITMAP "img/ko/S3.bmp"
|
||||
s4_KO BITMAP "img/ko/S4.bmp"
|
||||
save_KO BITMAP "img/ko/SAVE.bmp"
|
||||
final_KO BITMAP "img/ko/FINAL.bmp"
|
||||
|
||||
//portuges
|
||||
t1_PT_BR BITMAP "img/pt_br/T1.bmp"
|
||||
t2_PT_BR BITMAP "img/pt_br/T2.bmp"
|
||||
t3_PT_BR BITMAP "img/pt_br/T3.bmp"
|
||||
t4_PT_BR BITMAP "img/pt_br/T4.bmp"
|
||||
t5_PT_BR BITMAP "img/pt_br/T5.bmp"
|
||||
t6_PT_BR BITMAP "img/pt_br/T6.bmp"
|
||||
t7_PT_BR BITMAP "img/pt_br/T7.bmp"
|
||||
t8_PT_BR BITMAP "img/pt_br/T8.bmp"
|
||||
t9_PT_BR BITMAP "img/pt_br/T9.bmp"
|
||||
t10_PT_BR BITMAP "img/pt_br/T10.bmp"
|
||||
t11_PT_BR BITMAP "img/pt_br/T11.bmp"
|
||||
t12_PT_BR BITMAP "img/pt_br/T12.bmp"
|
||||
t13_PT_BR BITMAP "img/pt_br/T13.bmp"
|
||||
t14_PT_BR BITMAP "img/pt_br/T14.bmp"
|
||||
t15_PT_BR BITMAP "img/pt_br/T15.bmp"
|
||||
t16_PT_BR BITMAP "img/pt_br/T16.bmp"
|
||||
c1_PT_BR BITMAP "img/pt_br/C1.bmp"
|
||||
c2_PT_BR BITMAP "img/pt_br/C2.bmp"
|
||||
c3_PT_BR BITMAP "img/pt_br/C3.bmp"
|
||||
c4_PT_BR BITMAP "img/pt_br/C4.bmp"
|
||||
c5_PT_BR BITMAP "img/pt_br/C5.bmp"
|
||||
c6_PT_BR BITMAP "img/pt_br/C6.bmp"
|
||||
c7_PT_BR BITMAP "img/pt_br/C7.bmp"
|
||||
s1_PT_BR BITMAP "img/pt_br/S1.bmp"
|
||||
s2_PT_BR BITMAP "img/pt_br/S2.bmp"
|
||||
s3_PT_BR BITMAP "img/pt_br/S3.bmp"
|
||||
s4_PT_BR BITMAP "img/pt_br/S4.bmp"
|
||||
save_PT_BR BITMAP "img/pt_br/SAVE.bmp"
|
||||
final_PT_BR BITMAP "img/pt_br/FINAL.bmp"
|
||||
|
||||
//chinese
|
||||
t1_ZH_CN BITMAP "img/zh_cn/T1.bmp"
|
||||
t2_ZH_CN BITMAP "img/zh_cn/T2.bmp"
|
||||
t3_ZH_CN BITMAP "img/zh_cn/T3.bmp"
|
||||
t4_ZH_CN BITMAP "img/zh_cn/T4.bmp"
|
||||
t5_ZH_CN BITMAP "img/zh_cn/T5.bmp"
|
||||
t6_ZH_CN BITMAP "img/zh_cn/T6.bmp"
|
||||
t7_ZH_CN BITMAP "img/zh_cn/T7.bmp"
|
||||
t8_ZH_CN BITMAP "img/zh_cn/T8.bmp"
|
||||
t9_ZH_CN BITMAP "img/zh_cn/T9.bmp"
|
||||
t10_ZH_CN BITMAP "img/zh_cn/T10.bmp"
|
||||
t11_ZH_CN BITMAP "img/zh_cn/T11.bmp"
|
||||
t12_ZH_CN BITMAP "img/zh_cn/T12.bmp"
|
||||
t13_ZH_CN BITMAP "img/zh_cn/T13.bmp"
|
||||
t14_ZH_CN BITMAP "img/zh_cn/T14.bmp"
|
||||
t15_ZH_CN BITMAP "img/zh_cn/T15.bmp"
|
||||
t16_ZH_CN BITMAP "img/zh_cn/T16.bmp"
|
||||
c1_ZH_CN BITMAP "img/zh_cn/C1.bmp"
|
||||
c2_ZH_CN BITMAP "img/zh_cn/C2.bmp"
|
||||
c3_ZH_CN BITMAP "img/zh_cn/C3.bmp"
|
||||
c4_ZH_CN BITMAP "img/zh_cn/C4.bmp"
|
||||
c5_ZH_CN BITMAP "img/zh_cn/C5.bmp"
|
||||
c6_ZH_CN BITMAP "img/zh_cn/C6.bmp"
|
||||
c7_ZH_CN BITMAP "img/zh_cn/C7.bmp"
|
||||
s1_ZH_CN BITMAP "img/zh_cn/S1.bmp"
|
||||
s2_ZH_CN BITMAP "img/zh_cn/S2.bmp"
|
||||
s3_ZH_CN BITMAP "img/zh_cn/S3.bmp"
|
||||
s4_ZH_CN BITMAP "img/zh_cn/S4.bmp"
|
||||
save_ZH_CN BITMAP "img/zh_cn/SAVE.bmp"
|
||||
final_ZH_CN BITMAP "img/zh_cn/FINAL.bmp"
|
||||
|
|
@ -60,8 +60,8 @@ void loadLocale(const char* locale) {
|
|||
|
||||
_setLocaleFamily(locale);
|
||||
|
||||
int dictSize = 52;
|
||||
// currently there are 52
|
||||
int dictSize = 100;
|
||||
// currently there are 52, but 100 should be plenty if we ever do add more
|
||||
strdict = (char**)malloc(sizeof(char*) * dictSize);
|
||||
|
||||
sprintf(pathbuf, "Languages/internal/%s.po", locale);
|
||||
|
|
|
|||
41
src/main.cpp
41
src/main.cpp
|
|
@ -192,6 +192,45 @@ static void setupWindowIcon(const Config &conf, SDL_Window *win)
|
|||
}
|
||||
}
|
||||
|
||||
// mainly doing this so journal app knows where to load images from
|
||||
static void setGamePathInRegistry() {
|
||||
|
||||
// this logic is currently windows specific
|
||||
char* dataDir = SDL_GetBasePath();
|
||||
if (dataDir)
|
||||
{
|
||||
HKEY key;
|
||||
long keyOpenError = RegOpenKey(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), &key);
|
||||
|
||||
if (keyOpenError != ERROR_SUCCESS) {
|
||||
// try creating the key first
|
||||
long keyCreateError = RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), 0L, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL);
|
||||
|
||||
if (keyCreateError != ERROR_SUCCESS)
|
||||
{
|
||||
showInitError("Unable to create key in registry.");
|
||||
}
|
||||
else {
|
||||
keyOpenError = ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (keyOpenError != ERROR_SUCCESS)
|
||||
{
|
||||
showInitError("Unable to open registry.");
|
||||
}
|
||||
else {
|
||||
DWORD dataSize = (strlen(dataDir) + 1) * sizeof(char);
|
||||
if (RegSetValueEx(key, TEXT("GameDirectory"), 0, REG_SZ, (LPBYTE)dataDir, dataSize) != ERROR_SUCCESS)
|
||||
{
|
||||
showInitError("Unable to set GameDirectory registry value.");
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
SDL_free(dataDir);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||
|
|
@ -231,6 +270,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
setGamePathInRegistry();
|
||||
|
||||
/* Initialize physfs here so that config can call PHYSFS_getPrefDir */
|
||||
PHYSFS_init(argv[0]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue