mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-25 16:23:46 +02:00
Merge branch 'misc-fixes' into libretro-compat
This commit is contained in:
commit
ecc5cb5de3
9 changed files with 81 additions and 22 deletions
1
.github/workflows/autobuild.yml
vendored
1
.github/workflows/autobuild.yml
vendored
|
@ -29,7 +29,6 @@ jobs:
|
||||||
base-devel
|
base-devel
|
||||||
git
|
git
|
||||||
ruby
|
ruby
|
||||||
vim
|
|
||||||
mingw-w64-x86_64-cmake
|
mingw-w64-x86_64-cmake
|
||||||
mingw-w64-x86_64-meson
|
mingw-w64-x86_64-meson
|
||||||
mingw-w64-x86_64-autotools
|
mingw-w64-x86_64-autotools
|
||||||
|
|
|
@ -17,10 +17,11 @@ foreach file : embedded_assets_f
|
||||||
input: file,
|
input: file,
|
||||||
output: '@0@.xxd'.format(embedded_assets[count]),
|
output: '@0@.xxd'.format(embedded_assets[count]),
|
||||||
command: [
|
command: [
|
||||||
xxd, '-i', '@INPUT@'
|
embedtool,
|
||||||
|
'@INPUT@',
|
||||||
|
'@OUTPUT@',
|
||||||
|
'mkxp_assets_@0@'.format(embedded_assets[count].replace('.', '_')),
|
||||||
],
|
],
|
||||||
capture: true,
|
|
||||||
depend_files: embedded_assets_f[count]
|
|
||||||
)
|
)
|
||||||
count += 1
|
count += 1
|
||||||
endforeach
|
endforeach
|
||||||
|
|
59
embedtool.cpp
Normal file
59
embedtool.cpp
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
** embedtool.cpp
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc < 4) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *input = argv[1];
|
||||||
|
const char *output = argv[2];
|
||||||
|
const char *arrayname = argv[3];
|
||||||
|
|
||||||
|
std::ifstream inputf(input);
|
||||||
|
if (!inputf.is_open()) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ofstream outputf(output);
|
||||||
|
if (!outputf.is_open()) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputf << "#include <stddef.h>\n#include <stdint.h>\nconst uint8_t " << arrayname << "[] = {";
|
||||||
|
|
||||||
|
uint64_t len = 0;
|
||||||
|
for (;;) {
|
||||||
|
unsigned char c = inputf.get();
|
||||||
|
if (inputf.eof()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
outputf << (unsigned int)c << ',';
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputf << "};\nconst size_t " << arrayname << "_len = " << len << "ULL;";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -12,6 +12,8 @@ if not is_libretro and host_system == 'darwin'
|
||||||
error('This Meson project no longer supports macOS. Please use the Xcode project instead.')
|
error('This Meson project no longer supports macOS. Please use the Xcode project instead.')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
git_hash = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
|
||||||
|
|
||||||
compilers = {'c': meson.get_compiler('c'), 'cpp': meson.get_compiler('cpp')}
|
compilers = {'c': meson.get_compiler('c'), 'cpp': meson.get_compiler('cpp')}
|
||||||
|
|
||||||
global_sources = []
|
global_sources = []
|
||||||
|
@ -33,6 +35,8 @@ global_args += '-DHAVE_NANOSLEEP'
|
||||||
# ====================
|
# ====================
|
||||||
|
|
||||||
if is_libretro
|
if is_libretro
|
||||||
|
embedtool = executable('embedtool', sources: 'embedtool.cpp', native: true, override_options: [])
|
||||||
|
|
||||||
libretro_stage1_path = get_option('libretro_stage1_path')
|
libretro_stage1_path = get_option('libretro_stage1_path')
|
||||||
|
|
||||||
libretro_link_args = []
|
libretro_link_args = []
|
||||||
|
@ -587,8 +591,6 @@ if is_emscripten or not compilers['cpp'].compiles('struct E {}; int main() { thr
|
||||||
libretro_defines += '-DBOOST_NO_EXCEPTIONS'
|
libretro_defines += '-DBOOST_NO_EXCEPTIONS'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
xxd = find_program('xxd', native: true)
|
|
||||||
|
|
||||||
# STEAMWORKS
|
# STEAMWORKS
|
||||||
|
|
||||||
steamworks = false
|
steamworks = false
|
||||||
|
@ -674,6 +676,9 @@ endif
|
||||||
global_args += '-DMKXPZ_INIT_GL_LATER'
|
global_args += '-DMKXPZ_INIT_GL_LATER'
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
|
|
||||||
|
embedtool = executable('embedtool', sources: 'embedtool.cpp', native: true, override_options: [])
|
||||||
|
|
||||||
subdir('binding')
|
subdir('binding')
|
||||||
subdir('shader')
|
subdir('shader')
|
||||||
subdir('assets')
|
subdir('assets')
|
||||||
|
|
|
@ -42,10 +42,11 @@ foreach file : embedded_shaders_f
|
||||||
input: file,
|
input: file,
|
||||||
output: '@0@.xxd'.format(embedded_shaders[count]),
|
output: '@0@.xxd'.format(embedded_shaders[count]),
|
||||||
command: [
|
command: [
|
||||||
xxd, '-i', '@INPUT@'
|
embedtool,
|
||||||
|
'@INPUT@',
|
||||||
|
'@OUTPUT@',
|
||||||
|
'mkxp_shader_@0@'.format(embedded_shaders[count].replace('.', '_')),
|
||||||
],
|
],
|
||||||
capture: true,
|
|
||||||
depend_files: embedded_shaders_f[count]
|
|
||||||
)
|
)
|
||||||
count += 1
|
count += 1
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
@ -55,14 +55,8 @@
|
||||||
#define BUNDLED_FONT wqymicrohei
|
#define BUNDLED_FONT wqymicrohei
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUNDLED_FONT_DECL(FONT) \
|
#define BUNDLED_FONT_D(f) mkxp_assets_## f ##_ttf
|
||||||
extern unsigned char ___assets_##FONT##_ttf[]; \
|
#define BUNDLED_FONT_L(f) sizeof mkxp_assets_## f ##_ttf
|
||||||
extern unsigned int ___assets_##FONT##_ttf_len;
|
|
||||||
|
|
||||||
BUNDLED_FONT_DECL(liberation)
|
|
||||||
|
|
||||||
#define BUNDLED_FONT_D(f) ___assets_## f ##_ttf
|
|
||||||
#define BUNDLED_FONT_L(f) ___assets_## f ##_ttf_len
|
|
||||||
|
|
||||||
// Go fuck yourself CPP
|
// Go fuck yourself CPP
|
||||||
#define BNDL_F_D(f) BUNDLED_FONT_D(f)
|
#define BNDL_F_D(f) BUNDLED_FONT_D(f)
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
#else
|
#else
|
||||||
#define INIT_SHADER(vert, frag, name) \
|
#define INIT_SHADER(vert, frag, name) \
|
||||||
{ \
|
{ \
|
||||||
Shader::init(___shader_##vert##_vert, ___shader_##vert##_vert_len, ___shader_##frag##_frag, ___shader_##frag##_frag_len, \
|
Shader::init(mkxp_shader_##vert##_vert, sizeof mkxp_shader_##vert##_vert, mkxp_shader_##frag##_frag, sizeof mkxp_shader_##frag##_frag, \
|
||||||
#vert, #frag, #name); \
|
#vert, #frag, #name); \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -168,8 +168,8 @@ static void setupShaderSource(GLuint shader, GLenum type,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MKXPZ_BUILD_XCODE
|
#ifndef MKXPZ_BUILD_XCODE
|
||||||
shaderSrc[i] = (const GLchar*) ___shader_common_h;
|
shaderSrc[i] = (const GLchar*) mkxp_shader_common_h;
|
||||||
shaderSrcSize[i] = ___shader_common_h_len;
|
shaderSrcSize[i] = sizeof mkxp_shader_common_h;
|
||||||
#else
|
#else
|
||||||
shaderSrc[i] = (const GLchar*) Shader::commonHeader().c_str();
|
shaderSrc[i] = (const GLchar*) Shader::commonHeader().c_str();
|
||||||
shaderSrcSize[i] = Shader::commonHeader().length();
|
shaderSrcSize[i] = Shader::commonHeader().length();
|
||||||
|
|
|
@ -184,7 +184,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
SDL_GameControllerAddMappingsFromFile(mkxp_fs::getPathForAsset("gamecontrollerdb", "txt").c_str());
|
SDL_GameControllerAddMappingsFromFile(mkxp_fs::getPathForAsset("gamecontrollerdb", "txt").c_str());
|
||||||
#else
|
#else
|
||||||
SDL_GameControllerAddMappingsFromRW(
|
SDL_GameControllerAddMappingsFromRW(
|
||||||
SDL_RWFromConstMem(___assets_gamecontrollerdb_txt, ___assets_gamecontrollerdb_txt_len),
|
SDL_RWFromConstMem(mkxp_assets_gamecontrollerdb_txt, sizeof mkxp_assets_gamecontrollerdb_txt),
|
||||||
1);
|
1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ static void setupWindowIcon(const Config &conf, SDL_Window *win) {
|
||||||
|
|
||||||
if (conf.iconPath.empty())
|
if (conf.iconPath.empty())
|
||||||
#ifndef MKXPZ_BUILD_XCODE
|
#ifndef MKXPZ_BUILD_XCODE
|
||||||
iconSrc = SDL_RWFromConstMem(___assets_icon_png, ___assets_icon_png_len);
|
iconSrc = SDL_RWFromConstMem(mkxp_assets_icon_png, sizeof mkxp_assets_icon_png);
|
||||||
#else
|
#else
|
||||||
iconSrc = SDL_RWFromFile(mkxp_fs::getPathForAsset("icon", "png").c_str(), "rb");
|
iconSrc = SDL_RWFromFile(mkxp_fs::getPathForAsset("icon", "png").c_str(), "rb");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue