diff --git a/msvc2003/CSE2.rc b/msvc2003/CSE2.rc
index 7a012298..41f092ed 100644
--- a/msvc2003/CSE2.rc
+++ b/msvc2003/CSE2.rc
@@ -58,6 +58,85 @@ BEGIN
END
END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+CREDIT01 BITMAP "..\\assets\\resources\\BITMAP\\Credit01.bmp"
+CREDIT02 BITMAP "..\\assets\\resources\\BITMAP\\Credit02.bmp"
+CREDIT03 BITMAP "..\\assets\\resources\\BITMAP\\Credit03.bmp"
+CREDIT04 BITMAP "..\\assets\\resources\\BITMAP\\Credit04.bmp"
+CREDIT05 BITMAP "..\\assets\\resources\\BITMAP\\Credit05.bmp"
+CREDIT06 BITMAP "..\\assets\\resources\\BITMAP\\Credit06.bmp"
+CREDIT07 BITMAP "..\\assets\\resources\\BITMAP\\Credit07.bmp"
+CREDIT08 BITMAP "..\\assets\\resources\\BITMAP\\Credit08.bmp"
+CREDIT09 BITMAP "..\\assets\\resources\\BITMAP\\Credit09.bmp"
+CREDIT10 BITMAP "..\\assets\\resources\\BITMAP\\Credit10.bmp"
+CREDIT11 BITMAP "..\\assets\\resources\\BITMAP\\Credit11.bmp"
+CREDIT12 BITMAP "..\\assets\\resources\\BITMAP\\Credit12.bmp"
+CREDIT14 BITMAP "..\\assets\\resources\\BITMAP\\Credit14.bmp"
+CREDIT15 BITMAP "..\\assets\\resources\\BITMAP\\Credit15.bmp"
+CREDIT16 BITMAP "..\\assets\\resources\\BITMAP\\Credit16.bmp"
+CREDIT17 BITMAP "..\\assets\\resources\\BITMAP\\Credit17.bmp"
+CREDIT18 BITMAP "..\\assets\\resources\\BITMAP\\Credit18.bmp"
+PIXEL BITMAP "..\\assets\\resources\\BITMAP\\pixel.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// ORG
+//
+
+ACCESS ORG "..\\assets\\resources\\ORG\\Access.org"
+ANZEN ORG "..\\assets\\resources\\ORG\\Anzen.org"
+BALCONY ORG "..\\assets\\resources\\ORG\\Balcony.org"
+BALLOS ORG "..\\assets\\resources\\ORG\\Ballos.org"
+BDOWN ORG "..\\assets\\resources\\ORG\\BreakDown.org"
+CEMETERY ORG "..\\assets\\resources\\ORG\\Cemetery.org"
+CURLY ORG "..\\assets\\resources\\ORG\\Curly.org"
+DR ORG "..\\assets\\resources\\ORG\\Dr.org"
+ENDING ORG "..\\assets\\resources\\ORG\\Ending.org"
+ESCAPE ORG "..\\assets\\resources\\ORG\\Escape.org"
+FANFALE1 ORG "..\\assets\\resources\\ORG\\Fanfale1.org"
+FANFALE2 ORG "..\\assets\\resources\\ORG\\Fanfale2.org"
+FANFALE3 ORG "..\\assets\\resources\\ORG\\Fanfale3.org"
+FIREEYE ORG "..\\assets\\resources\\ORG\\FireEye.org"
+GAMEOVER ORG "..\\assets\\resources\\ORG\\Gameover.org"
+GINSUKE ORG "..\\assets\\resources\\ORG\\Ginsuke.org"
+GRAND ORG "..\\assets\\resources\\ORG\\Grand.org"
+GRAVITY ORG "..\\assets\\resources\\ORG\\Gravity.org"
+HELL ORG "..\\assets\\resources\\ORG\\Hell.org"
+IRONH ORG "..\\assets\\resources\\ORG\\ironH.org"
+JENKA ORG "..\\assets\\resources\\ORG\\Jenka.org"
+JENKA2 ORG "..\\assets\\resources\\ORG\\Jenka2.org"
+KODOU ORG "..\\assets\\resources\\ORG\\Kodou.org"
+LASTBTL ORG "..\\assets\\resources\\ORG\\LastBtl.org"
+LASTBT3 ORG "..\\assets\\resources\\ORG\\LastBtl3.org"
+LASTCAVE ORG "..\\assets\\resources\\ORG\\LastCave.org"
+MARINE ORG "..\\assets\\resources\\ORG\\Marine.org"
+MAZE ORG "..\\assets\\resources\\ORG\\Maze.org"
+MDOWN2 ORG "..\\assets\\resources\\ORG\\MDown2.org"
+OSIDE ORG "..\\assets\\resources\\ORG\\Oside.org"
+MURA ORG "..\\assets\\resources\\ORG\\Mura.org"
+PLANT ORG "..\\assets\\resources\\ORG\\Plant.org"
+QUIET ORG "..\\assets\\resources\\ORG\\quiet.org"
+REQUIEM ORG "..\\assets\\resources\\ORG\\Requiem.org"
+TOROKO ORG "..\\assets\\resources\\ORG\\Toroko.org"
+VIVI ORG "..\\assets\\resources\\ORG\\Vivi.org"
+WANPAK2 ORG "..\\assets\\resources\\ORG\\Wanpak2.org"
+WANPAKU ORG "..\\assets\\resources\\ORG\\Wanpaku.org"
+WEED ORG "..\\assets\\resources\\ORG\\Weed.org"
+WHITE ORG "..\\assets\\resources\\ORG\\White.org"
+XXXX ORG "..\\assets\\resources\\ORG\\XXXX.org"
+ZONBIE ORG "..\\assets\\resources\\ORG\\Zonbie.org"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// WAVE
+//
+
+WAVE100 WAVE "..\\assets\\resources\\WAVE\\Wave.dat"
#endif // Japanese resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/msvc2003/CSE2.vcproj b/msvc2003/CSE2.vcproj
index d05b67ac..8d75e74d 100644
--- a/msvc2003/CSE2.vcproj
+++ b/msvc2003/CSE2.vcproj
@@ -421,9 +421,6 @@
-
-
@@ -597,9 +594,6 @@
-
-
@@ -641,8 +635,212 @@
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/msvc2003/resource1.h b/msvc2003/resource1.h
index ea7bc238..d4192dd8 100644
--- a/msvc2003/resource1.h
+++ b/msvc2003/resource1.h
@@ -7,7 +7,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_RESOURCE_VALUE 169
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/src/Draw.cpp b/src/Draw.cpp
index e1c849ff..8c507b27 100644
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -13,7 +13,6 @@
#include "CommonDefines.h"
#include "Font.h"
-#include "Resource.h"
#include "Tags.h"
#include "Backends/Rendering.h"
@@ -379,13 +378,32 @@ static BOOL LoadBitmap_File(const char *name, SurfaceID surf_no, BOOL create_sur
static BOOL LoadBitmap_Resource(const char *res, SurfaceID surf_no, BOOL create_surface)
{
- size_t size;
- const unsigned char *data = FindResource(res, "BITMAP", &size);
+ HRSRC hrscr = FindResourceA(NULL, res, RT_BITMAP);
- if (data)
- if (LoadBitmap(data, size, surf_no, create_surface, res, SURFACE_SOURCE_RESOURCE))
- return TRUE;
+ if (hrscr == NULL)
+ return FALSE;
+ size_t size = SizeofResource(NULL, hrscr);
+ const unsigned char *data = (unsigned char*)LockResource(LoadResource(NULL, hrscr));
+
+ // The bitmap we get from LockResource is incomplete, so we need to restore its missing header here
+ unsigned char *bmp_buffer = (unsigned char*)malloc(size + 0xE);
+
+ if (bmp_buffer == NULL)
+ return FALSE;
+
+ const unsigned char bmp_header[0xE] = {0x42, 0x4D, 0x76, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00};
+
+ memcpy(bmp_buffer, bmp_header, 0xE);
+ memcpy(bmp_buffer + 0xE, data, size);
+
+ if (LoadBitmap(bmp_buffer, size + 0xE, surf_no, create_surface, res, SURFACE_SOURCE_RESOURCE))
+ {
+ free(bmp_buffer);
+ return TRUE;
+ }
+
+ free(bmp_buffer);
printf("Failed to open resource %s\n", res);
return FALSE;
}
@@ -644,11 +662,11 @@ void InitTextObject(const char *font_name)
#endif
#endif
// Fall back on the built-in font
- (void)font_name;
+/* (void)font_name;
const unsigned char *res_data = FindResource("DEFAULT_FONT", "FONT", &data_size);
if (res_data != NULL)
- gFont = LoadFontFromData(res_data, data_size, fontWidth, fontHeight);
+ gFont = LoadFontFromData(res_data, data_size, fontWidth, fontHeight);*/
}
void PutText(int x, int y, const char *text, unsigned long color)
diff --git a/src/Main.cpp b/src/Main.cpp
index 9ec79bb8..0d352b72 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -18,7 +18,6 @@
#include "MyChar.h"
#include "Organya.h"
#include "Profile.h"
-#include "Resource.h"
#include "Sound.h"
#include "Triangle.h"
@@ -106,8 +105,8 @@ int main(int argc, char *argv[])
#ifdef WINDOWS
// Set the window icons. See res/ICON/ICON.rc.
- SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON, "101");
- SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
+// SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON, "101");
+// SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
#endif
// Initialize SDL
@@ -212,7 +211,7 @@ int main(int argc, char *argv[])
RECT unused_rect = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
- // Load cursor
+/* // Load cursor
size_t size;
const unsigned char *data = FindResource("CURSOR_NORMAL", "CURSOR", &size);
@@ -236,7 +235,7 @@ int main(int argc, char *argv[])
{
printf("Failed to load cursor\n");
}
-
+*/
// Get window dimensions and colour depth
int windowWidth;
int windowHeight;
@@ -315,7 +314,7 @@ int main(int argc, char *argv[])
bFps = TRUE;
#ifndef WINDOWS
- // Load icon
+/* // Load icon
size_t size;
const unsigned char *data = FindResource("ICON_MINI", "ICON", &size);
@@ -334,7 +333,7 @@ int main(int argc, char *argv[])
else
{
printf("Failed to load icon\n");
- }
+ }*/
#endif
// Set rects
diff --git a/src/Organya.cpp b/src/Organya.cpp
index e8305421..57aab2b4 100644
--- a/src/Organya.cpp
+++ b/src/Organya.cpp
@@ -14,7 +14,6 @@
#include "WindowsWrapper.h"
-#include "Resource.h"
#include "Sound.h"
#define PANDUMMY 0xFF
@@ -267,11 +266,13 @@ signed char wave_data[100][0x100];
BOOL InitWaveData100()
{
- const unsigned char *data = FindResource("WAVE100", "WAVE", NULL);
+ HRSRC hrscr = FindResourceA(NULL, "WAVE100", "WAVE");
- if (data == NULL)
+ if (hrscr == NULL)
return FALSE;
+ const unsigned char *data = (unsigned char*)LockResource(LoadResource(NULL, hrscr));
+
memcpy(wave_data, data, 100 * 0x100);
return TRUE;
@@ -432,7 +433,12 @@ void LoadOrganya(const char *name)
memset(now_leng, 0, sizeof(now_leng));
// Open file
- const unsigned char *p = FindResource(name, "ORG", NULL);
+ HRSRC hrscr = FindResourceA(NULL, name, "ORG");
+
+ if (hrscr == NULL)
+ return;
+
+ const unsigned char *p = (unsigned char*)LockResource(LoadResource(NULL, hrscr));
// Version Check
unsigned char ver = 0;
diff --git a/src/Resource.cpp b/src/Resource.cpp
deleted file mode 100644
index 99f872cf..00000000
--- a/src/Resource.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-#include "Resource.h"
-
-#include
-#include
-
-#include "Resource/ORG/Access.org.h"
-#include "Resource/ORG/Anzen.org.h"
-#include "Resource/ORG/Balcony.org.h"
-#include "Resource/ORG/Ballos.org.h"
-#include "Resource/ORG/BreakDown.org.h"
-#include "Resource/ORG/Cemetery.org.h"
-#include "Resource/ORG/Curly.org.h"
-#include "Resource/ORG/Dr.org.h"
-#include "Resource/ORG/Ending.org.h"
-#include "Resource/ORG/Escape.org.h"
-#include "Resource/ORG/Fanfale1.org.h"
-#include "Resource/ORG/Fanfale2.org.h"
-#include "Resource/ORG/Fanfale3.org.h"
-#include "Resource/ORG/FireEye.org.h"
-#include "Resource/ORG/Gameover.org.h"
-#include "Resource/ORG/Ginsuke.org.h"
-#include "Resource/ORG/Grand.org.h"
-#include "Resource/ORG/Gravity.org.h"
-#include "Resource/ORG/Hell.org.h"
-#include "Resource/ORG/ironH.org.h"
-#include "Resource/ORG/Jenka.org.h"
-#include "Resource/ORG/Jenka2.org.h"
-#include "Resource/ORG/Kodou.org.h"
-#include "Resource/ORG/LastBtl3.org.h"
-#include "Resource/ORG/LastBtl.org.h"
-#include "Resource/ORG/LastCave.org.h"
-#include "Resource/ORG/Marine.org.h"
-#include "Resource/ORG/Maze.org.h"
-#include "Resource/ORG/MDown2.org.h"
-#include "Resource/ORG/Mura.org.h"
-#include "Resource/ORG/Oside.org.h"
-#include "Resource/ORG/Plant.org.h"
-#include "Resource/ORG/quiet.org.h"
-#include "Resource/ORG/Requiem.org.h"
-#include "Resource/ORG/Toroko.org.h"
-#include "Resource/ORG/Vivi.org.h"
-#include "Resource/ORG/Wanpak2.org.h"
-#include "Resource/ORG/Wanpaku.org.h"
-#include "Resource/ORG/Weed.org.h"
-#include "Resource/ORG/White.org.h"
-#include "Resource/ORG/XXXX.org.h"
-#include "Resource/ORG/Zonbie.org.h"
-#include "Resource/WAVE/Wave.dat.h"
-#include "Resource/BITMAP/Credit01.bmp.h"
-#include "Resource/BITMAP/Credit02.bmp.h"
-#include "Resource/BITMAP/Credit03.bmp.h"
-#include "Resource/BITMAP/Credit04.bmp.h"
-#include "Resource/BITMAP/Credit05.bmp.h"
-#include "Resource/BITMAP/Credit06.bmp.h"
-#include "Resource/BITMAP/Credit07.bmp.h"
-#include "Resource/BITMAP/Credit08.bmp.h"
-#include "Resource/BITMAP/Credit09.bmp.h"
-#include "Resource/BITMAP/Credit10.bmp.h"
-#include "Resource/BITMAP/Credit11.bmp.h"
-#include "Resource/BITMAP/Credit12.bmp.h"
-#include "Resource/BITMAP/Credit14.bmp.h"
-#include "Resource/BITMAP/Credit15.bmp.h"
-#include "Resource/BITMAP/Credit16.bmp.h"
-#include "Resource/BITMAP/Credit17.bmp.h"
-#include "Resource/BITMAP/Credit18.bmp.h"
-#ifdef JAPANESE
-#include "Resource/BITMAP/pixel_jp.bmp.h"
-#else
-#include "Resource/BITMAP/pixel.bmp.h"
-#endif
-#ifndef WINDOWS
-#include "Resource/ICON/ICON_MINI.bmp.h"
-#endif
-#include "Resource/CURSOR/CURSOR_IKA.bmp.h"
-#include "Resource/CURSOR/CURSOR_NORMAL.bmp.h"
-
-#ifdef JAPANESE
-#include "Resource/FONT/msgothic.ttc.h"
-#else
-#ifndef WINDOWS
-#include "Resource/FONT/cour.ttf.h"
-#endif
-#endif
-
-static const struct
-{
- const char *type;
- const char *name;
- const unsigned char *data;
- size_t size;
-} resources[] = {
- {"ORG", "ACCESS", rAccess, sizeof(rAccess)},
- {"ORG", "ANZEN", rAnzen, sizeof(rAnzen)},
- {"ORG", "BALCONY", rBalcony, sizeof(rBalcony)},
- {"ORG", "BALLOS", rBallos, sizeof(rBallos)},
- {"ORG", "BDOWN", rBreakDown, sizeof(rBreakDown)},
- {"ORG", "CEMETERY", rCemetery, sizeof(rCemetery)},
-#ifdef NONPORTABLE
- {"ORG", "Curly", rCurly, sizeof(rCurly)},
-#else
- {"ORG", "CURLY", rCurly, sizeof(rCurly)},
-#endif
- {"ORG", "DR", rDr, sizeof(rDr)},
- {"ORG", "ENDING", rEnding, sizeof(rEnding)},
- {"ORG", "ESCAPE", rEscape, sizeof(rEscape)},
- {"ORG", "FANFALE1", rFanfale1, sizeof(rFanfale1)},
- {"ORG", "FANFALE2", rFanfale2, sizeof(rFanfale2)},
- {"ORG", "FANFALE3", rFanfale3, sizeof(rFanfale3)},
- {"ORG", "FIREEYE", rFireEye, sizeof(rFireEye)},
- {"ORG", "GAMEOVER", rGameover, sizeof(rGameover)},
- {"ORG", "GINSUKE", rGinsuke, sizeof(rGinsuke)},
- {"ORG", "GRAND", rGrand, sizeof(rGrand)},
- {"ORG", "GRAVITY", rGravity, sizeof(rGravity)},
- {"ORG", "HELL", rHell, sizeof(rHell)},
- {"ORG", "IRONH", rironH, sizeof(rironH)},
- {"ORG", "JENKA", rJenka, sizeof(rJenka)},
- {"ORG", "JENKA2", rJenka2, sizeof(rJenka2)},
- {"ORG", "KODOU", rKodou, sizeof(rKodou)},
- {"ORG", "LASTBT3", rLastBtl3, sizeof(rLastBtl3)},
- {"ORG", "LASTBTL", rLastBtl, sizeof(rLastBtl)},
- {"ORG", "LASTCAVE", rLastCave, sizeof(rLastCave)},
- {"ORG", "MARINE", rMarine, sizeof(rMarine)},
- {"ORG", "MAZE", rMaze, sizeof(rMaze)},
- {"ORG", "MDOWN2", rMDown2, sizeof(rMDown2)},
- {"ORG", "MURA", rMura, sizeof(rMura)},
- {"ORG", "OSIDE", rOside, sizeof(rOside)},
- {"ORG", "PLANT", rPlant, sizeof(rPlant)},
- {"ORG", "QUIET", rquiet, sizeof(rquiet)},
- {"ORG", "REQUIEM", rRequiem, sizeof(rRequiem)},
- {"ORG", "TOROKO", rToroko, sizeof(rToroko)},
- {"ORG", "VIVI", rVivi, sizeof(rVivi)},
- {"ORG", "WANPAK2", rWanpak2, sizeof(rWanpak2)},
- {"ORG", "WANPAKU", rWanpaku, sizeof(rWanpaku)},
- {"ORG", "WEED", rWeed, sizeof(rWeed)},
- {"ORG", "WHITE", rWhite, sizeof(rWhite)},
- {"ORG", "XXXX", rXXXX, sizeof(rXXXX)},
- {"ORG", "ZONBIE", rZonbie, sizeof(rZonbie)},
-
- {"WAVE", "WAVE100", rWave, sizeof(rWave)},
-
- {"BITMAP", "CREDIT01", rCredit01, sizeof(rCredit01)},
- {"BITMAP", "CREDIT02", rCredit02, sizeof(rCredit02)},
- {"BITMAP", "CREDIT03", rCredit03, sizeof(rCredit03)},
- {"BITMAP", "CREDIT04", rCredit04, sizeof(rCredit04)},
- {"BITMAP", "CREDIT05", rCredit05, sizeof(rCredit05)},
- {"BITMAP", "CREDIT06", rCredit06, sizeof(rCredit06)},
- {"BITMAP", "CREDIT07", rCredit07, sizeof(rCredit07)},
- {"BITMAP", "CREDIT08", rCredit08, sizeof(rCredit08)},
- {"BITMAP", "CREDIT09", rCredit09, sizeof(rCredit09)},
- {"BITMAP", "CREDIT10", rCredit10, sizeof(rCredit10)},
- {"BITMAP", "CREDIT11", rCredit11, sizeof(rCredit11)},
- {"BITMAP", "CREDIT12", rCredit12, sizeof(rCredit12)},
- {"BITMAP", "CREDIT14", rCredit14, sizeof(rCredit14)},
- {"BITMAP", "CREDIT15", rCredit15, sizeof(rCredit15)},
- {"BITMAP", "CREDIT16", rCredit16, sizeof(rCredit16)},
- {"BITMAP", "CREDIT17", rCredit17, sizeof(rCredit17)},
- {"BITMAP", "CREDIT18", rCredit18, sizeof(rCredit18)},
-#ifdef JAPANESE
- {"BITMAP", "PIXEL", rpixel_jp, sizeof(rpixel_jp)},
-#else
- {"BITMAP", "PIXEL", rpixel, sizeof(rpixel)},
-#endif
-
-#ifndef WINDOWS
- {"ICON", "ICON_MINI", rICON_MINI, sizeof(rICON_MINI)},
-#endif
-
- {"CURSOR", "CURSOR_NORMAL", rCURSOR_NORMAL, sizeof(rCURSOR_NORMAL)},
- {"CURSOR", "CURSOR_IKA", rCURSOR_IKA, sizeof(rCURSOR_IKA)},
-
-#ifdef JAPANESE
- {"FONT", "DEFAULT_FONT", rmsgothic, sizeof(rmsgothic)},
-#else
-#ifndef WINDOWS
- {"FONT", "DEFAULT_FONT", rcour, sizeof(rcour)},
-#endif
-#endif
-};
-
-const unsigned char* FindResource(const char *name, const char *type, size_t *size)
-{
- for (unsigned int i = 0; i < sizeof(resources) / sizeof(resources[0]); ++i)
- {
- if (!strcmp(name, resources[i].name) && !strcmp(type, resources[i].type))
- {
- if (size)
- *size = resources[i].size;
-
- return resources[i].data;
- }
- }
-
- return NULL;
-}
diff --git a/src/Resource.h b/src/Resource.h
deleted file mode 100644
index 9f477df6..00000000
--- a/src/Resource.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#include
-
-const unsigned char* FindResource(const char *name, const char *type, size_t *size);