1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

remove expansion packs from title sequence, closes #752

This commit is contained in:
IntelOrca
2015-02-11 22:17:49 +00:00
parent 2bbaa0fc4c
commit 392ff7bfea
7 changed files with 78 additions and 63 deletions

View File

@@ -558,50 +558,6 @@ void osinterface_free()
SDL_Quit();
}
/**
*
* rct2: 0x00407978
*/
int osinterface_407978(rct2_install_info* install_info, char* source, char* font, uint8 charset)
{
char subkey[MAX_PATH];
char subkey2[MAX_PATH];
strcpy(subkey, "Software\\Infogrames\\");
strcat(subkey, source);
strcpy(subkey2, "Software\\Fish Technology Group\\");
strcat(subkey2, source);
LOGFONTA lf;
memset(&lf, 0, sizeof(lf));
lf.lfCharSet = charset;
lf.lfHeight = 12;
lf.lfWeight = 400;
strcpy(lf.lfFaceName, font);
RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT) = CreateFontIndirectA(&lf);
HKEY hkey;
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &hkey) != ERROR_SUCCESS && RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey2, &hkey) != ERROR_SUCCESS) {
return 0;
} else {
DWORD type;
DWORD size = 260;
RegQueryValueExA(hkey, "Title", 0, &type, install_info->title, &size);
size = 260;
RegQueryValueExA(hkey, "Path", 0, &type, install_info->path, &size);
install_info->var_20C = 235960;
size = 4;
RegQueryValueExA(hkey, "InstallLevel", 0, &type, (LPBYTE)&install_info->installlevel, &size);
for (int i = 0; i <= 15; i++) {
char name[100];
sprintf(name, "AddonPack%d", i);
size = sizeof(install_info->addon[i]);
if (RegQueryValueExA(hkey, name, 0, &type, install_info->addon[i], &size) == ERROR_SUCCESS) {
install_info->addons |= (1 << i);
}
}
RegCloseKey(hkey);
return 1;
}
}
/**
*
* rct2: 0x00407D80

View File

@@ -69,16 +69,6 @@ typedef struct {
int old;
} openrct2_cursor;
typedef struct {
uint32 installlevel;
char title[260];
char path[260];
uint32 var_20C;
uint8 pad_210[0x100];
char addon[16][0x80];
uint32 addons; //0xB10
} rct2_install_info;
extern openrct2_cursor gCursorState;
extern const unsigned char *gKeysState;
extern unsigned char *gKeysPressed;

View File

@@ -65,4 +65,8 @@ void platform_get_cursor_position(int *x, int *y);
void platform_set_cursor_position(int x, int y);
unsigned int platform_get_ticks();
#ifdef _WIN32
int windows_get_registry_install_info(rct2_install_info *installInfo, char *source, char *font, uint8 charset);
#endif
#endif

View File

@@ -223,6 +223,58 @@ unsigned int platform_get_ticks()
return GetTickCount();
}
/**
*
* rct2: 0x00407978
*/
int windows_get_registry_install_info(rct2_install_info *installInfo, char *source, char *font, uint8 charset)
{
char subkeyInfogrames[MAX_PATH], subkeyFishTechGroup[MAX_PATH], keyName[100];
LOGFONTA lf;
HKEY hKey;
DWORD type, size;
strcpy(subkeyInfogrames, "Software\\Infogrames\\");
strcat(subkeyInfogrames, source);
strcpy(subkeyFishTechGroup, "Software\\Fish Technology Group\\");
strcat(subkeyFishTechGroup, source);
memset(&lf, 0, sizeof(lf));
lf.lfCharSet = charset;
lf.lfHeight = 12;
lf.lfWeight = 400;
strcpy(lf.lfFaceName, font);
RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT) = CreateFontIndirectA(&lf);
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, subkeyInfogrames, &hKey) != ERROR_SUCCESS)
return 0;
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, subkeyFishTechGroup, &hKey) != ERROR_SUCCESS)
return 0;
size = 260;
RegQueryValueExA(hKey, "Title", 0, &type, installInfo->title, &size);
size = 260;
RegQueryValueExA(hKey, "Path", 0, &type, installInfo->path, &size);
installInfo->var_20C = 235960;
size = 4;
RegQueryValueExA(hKey, "InstallLevel", 0, &type, (LPBYTE)&installInfo->installLevel, &size);
for (int i = 0; i <= 15; i++) {
sprintf(keyName, "AddonPack%d", i);
size = sizeof(installInfo->expansionPackNames[i]);
if (RegQueryValueExA(hKey, keyName, 0, &type, installInfo->expansionPackNames[i], &size) == ERROR_SUCCESS)
installInfo->activeExpansionPacks |= (1 << i);
}
RegCloseKey(hKey);
return 1;
}
/**
* http://alter.org.ua/en/docs/win/args/
*/

View File

@@ -129,6 +129,8 @@ int rct2_init()
*/
int rct2_init_directories()
{
// windows_get_registry_install_info((rct2_install_info*)0x009AA10C, "RollerCoaster Tycoon 2 Setup", "MS Sans Serif", 0);
// check install directory
if (!platform_directory_exists(gGeneral_config.game_path)) {
log_verbose("install directory does not exist, %s", gGeneral_config.game_path);

View File

@@ -109,6 +109,16 @@ typedef fixed32_1dp money32;
typedef void (EMPTY_ARGS_VOID_POINTER)();
typedef unsigned short rct_string_id;
typedef struct {
uint32 installLevel;
char title[260];
char path[260];
uint32 var_20C;
uint8 pad_210[256];
char expansionPackNames[16][128];
uint32 activeExpansionPacks; //0xB10
} rct2_install_info;
enum {
// Although this is labeled a flag it actually means when
// zero the screen is in playing mode.

View File

@@ -63,6 +63,8 @@ static void* window_title_logo_events[] = {
window_title_logo_emptysub
};
static void window_title_logo_draw_expansion_packs(rct_drawpixelinfo *dpi);
/**
* Creates the window containing the logo and the expansion packs on the title screen.
* rct2: 0x0066B679 (part of 0x0066B3E8)
@@ -94,23 +96,26 @@ void window_title_logo_open()
*/
static void window_title_logo_paint()
{
int packs, x, y, i;
char *buffer, *names;
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
gfx_draw_sprite(dpi, SPR_MENU_LOGO, w->x, w->y, 0);
window_title_logo_draw_expansion_packs(dpi);
}
static void window_title_logo_draw_expansion_packs(rct_drawpixelinfo *dpi)
{
int packs, x, y, i;
char *buffer, *names;
x = 0;
y = 105;
packs = RCT2_GLOBAL(RCT2_ADDRESS_EXPANSION_FLAGS, uint16);
names = RCT2_ADDRESS(RCT2_ADDRESS_EXPANSION_NAMES, char);
buffer = (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER;
while (packs != 0) {
if (packs & 1) {
// Prefix for expansion name
@@ -120,23 +125,19 @@ static void window_title_logo_paint()
buffer[3] = '+';
buffer[4] = ' ';
i = 0;
// Copies the expansion name to the buffer, offset by 5
i = 0;
do {
buffer[5 + i] = names[i];
i++;
} while (names[i - 1] != 0);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint32) = 0;
gfx_draw_string(dpi, buffer, 0, x, y);
y += 10;
}
packs = packs >> 1;
names += 128;
}
}