mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-27 17:38:01 +03:00
Support building with Microsoft Visual Studio
This commit is contained in:
Vendored
+1
-1
Submodule deps/fmgen updated: d74357ec4b...7246b59cac
+53
-5
@@ -48,16 +48,64 @@ elseif (EMSCRIPTEN)
|
||||
|
||||
else() # NOT (ANDROID OR EMSCRIPTEN)
|
||||
add_executable(system3)
|
||||
target_link_libraries(system3 PRIVATE fmgen)
|
||||
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF REQUIRED IMPORTED_TARGET SDL2_ttf)
|
||||
target_link_libraries(system3 PRIVATE PkgConfig::SDL2 PkgConfig::SDL2TTF fmgen)
|
||||
if (MSVC)
|
||||
if (CMAKE_VS_PLATFORM_NAME STREQUAL "Win32")
|
||||
set(ARCH "x86")
|
||||
else()
|
||||
set(ARCH "x64")
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(sdl2
|
||||
URL http://libsdl.org/release/SDL2-devel-2.0.14-VC.zip)
|
||||
FetchContent_GetProperties(sdl2)
|
||||
if (NOT sdl2_POPULATED)
|
||||
FetchContent_Populate(sdl2)
|
||||
endif()
|
||||
set(SDL2_LIB_DIR "${sdl2_SOURCE_DIR}/lib/${ARCH}")
|
||||
add_library(SDL2 SHARED IMPORTED)
|
||||
target_include_directories(SDL2 INTERFACE ${sdl2_SOURCE_DIR}/include)
|
||||
set_target_properties(SDL2 PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2_LIB_DIR}/SDL2.dll
|
||||
IMPORTED_IMPLIB ${SDL2_LIB_DIR}/SDL2.lib
|
||||
)
|
||||
target_link_libraries(SDL2 INTERFACE ${SDL2_LIB_DIR}/SDL2main.lib)
|
||||
|
||||
FetchContent_Declare(sdl2_ttf
|
||||
URL http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip)
|
||||
FetchContent_GetProperties(sdl2_ttf)
|
||||
if (NOT sdl2_ttf_POPULATED)
|
||||
FetchContent_Populate(sdl2_ttf)
|
||||
endif()
|
||||
set(SDL2TTF_LIB_DIR "${sdl2_ttf_SOURCE_DIR}/lib/${ARCH}")
|
||||
add_library(SDL2TTF SHARED IMPORTED)
|
||||
target_include_directories(SDL2TTF INTERFACE ${sdl2_ttf_SOURCE_DIR}/include)
|
||||
set_target_properties(SDL2TTF PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2TTF_LIB_DIR}/SDL2_ttf.dll
|
||||
IMPORTED_IMPLIB ${SDL2TTF_LIB_DIR}/SDL2_ttf.lib
|
||||
)
|
||||
|
||||
target_compile_definitions(system3 PRIVATE _CRT_NONSTDC_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_options(system3 PRIVATE /utf-8)
|
||||
target_link_libraries(system3 PRIVATE SDL2 SDL2TTF)
|
||||
set_target_properties(system3 PROPERTIES
|
||||
VS_DEBUGGER_ENVIRONMENT "PATH=${SDL2_LIB_DIR}$<SEMICOLON>${SDL2TTF_LIB_DIR}$<SEMICOLON>$ENV{PATH}")
|
||||
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT system3)
|
||||
else()
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF REQUIRED IMPORTED_TARGET SDL2_ttf)
|
||||
target_link_libraries(system3 PRIVATE PkgConfig::SDL2 PkgConfig::SDL2TTF)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_sources(system3 PRIVATE win/nact_win.cpp win/mako.cpp res3/Script1.rc)
|
||||
target_link_libraries(system3 PRIVATE winmm)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
|
||||
if (MSYS)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
|
||||
endif()
|
||||
else()
|
||||
pkg_check_modules(SDL2MIXER REQUIRED IMPORTED_TARGET SDL2_mixer)
|
||||
target_sources(system3 PRIVATE
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "fileio.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
+5
-1
@@ -1,9 +1,13 @@
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "common.h"
|
||||
#include "fileio.h"
|
||||
#include "sys/nact.h"
|
||||
#include "sys/mako.h"
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
#include "crc32.h"
|
||||
#include "../fileio.h"
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::load_cursor(int page)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
#include "dri.h"
|
||||
#include "crc32.h"
|
||||
|
||||
@@ -13,13 +14,13 @@ void AGS::load_cg(int page, int transparent)
|
||||
if (nact->sys_ver == 3) {
|
||||
// あゆみちゃん物語 フルカラー実写版
|
||||
if(strncmp(acg, "CGA000.BMP", 10) == 0) {
|
||||
char file_name[_MAX_PATH];
|
||||
sprintf_s(file_name, _MAX_PATH, "CGA%03d.BMP", page);
|
||||
char file_name[16];
|
||||
sprintf(file_name, "CGA%03d.BMP", page);
|
||||
load_bmp(file_name);
|
||||
return;
|
||||
} else if(strncmp(acg, "CGB000.BMP", 10) == 0) {
|
||||
char file_name[_MAX_PATH];
|
||||
sprintf_s(file_name, _MAX_PATH, "CGB%03d.BMP", page);
|
||||
char file_name[16];
|
||||
sprintf(file_name, "CGB%03d.BMP", page);
|
||||
load_bmp(file_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::load_gl3(uint8* data, int page, int transparent)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::load_gm3(uint8* data, int page, int transparent)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "ags.h"
|
||||
#include "crc32.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::load_pms(uint8* data, int page, int transparent)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "ags.h"
|
||||
#include "crc32.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::load_vsp(uint8* data, int page, int transparent)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::load_vsp2l(uint8* data, int page, int transparent)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <string.h>
|
||||
|
||||
void AGS::clear_text_window(int index, bool erase)
|
||||
{
|
||||
|
||||
+3
-2
@@ -5,13 +5,14 @@
|
||||
*/
|
||||
|
||||
#include "dri.h"
|
||||
#include <string.h>
|
||||
#include "crc32.h"
|
||||
#include "../fileio.h"
|
||||
|
||||
uint8* DRI::load(const char* file_name, int page, int* size)
|
||||
{
|
||||
char tmp_name[_MAX_PATH];
|
||||
strcpy_s(tmp_name, _MAX_PATH, file_name);
|
||||
char tmp_name[20];
|
||||
strcpy_s(tmp_name, sizeof(tmp_name), file_name);
|
||||
|
||||
FILEIO* fio = new FILEIO();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "msgskip.h"
|
||||
#include <string.h>
|
||||
#include "nact.h"
|
||||
#include "fileio.h"
|
||||
|
||||
|
||||
+1
-1
@@ -82,8 +82,8 @@ constexpr char SJIS_NEXT_PAGE [] = "\x8E\x9F\x82\xCC\x83\x79\x81\x5B\x83\x57"; /
|
||||
|
||||
class AGS;
|
||||
class MAKO;
|
||||
class MAKOConfig;
|
||||
class MsgSkip;
|
||||
struct MAKOConfig;
|
||||
|
||||
class NACT
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "nact.h"
|
||||
#include <string.h>
|
||||
#include "crc32.h"
|
||||
#include "../fileio.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "nact.h"
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#undef ERROR
|
||||
#include <time.h>
|
||||
#include "nact.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "ags.h"
|
||||
#include "mako.h"
|
||||
@@ -122,7 +123,7 @@ INT_PTR CALLBACK TextDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
|
||||
void NACT::text_dialog()
|
||||
{
|
||||
HINSTANCE hinst = (HINSTANCE)GetModuleHandle(NULL);
|
||||
int r = DialogBoxParam(hinst, MAKEINTRESOURCE(IDD_DIALOG1), get_hwnd(g_window), TextDialogProc, (LPARAM)this);
|
||||
DialogBoxParam(hinst, MAKEINTRESOURCE(IDD_DIALOG1), get_hwnd(g_window), TextDialogProc, (LPARAM)this);
|
||||
}
|
||||
|
||||
void NACT::platform_initialize()
|
||||
|
||||
Reference in New Issue
Block a user