mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 23:33:45 +02:00
Fix some compilation errors in standalone builds
This commit is contained in:
parent
3fec509568
commit
aef7eff511
4 changed files with 47 additions and 18 deletions
|
@ -23,6 +23,7 @@
|
||||||
#define ALDATASOURCE_H
|
#define ALDATASOURCE_H
|
||||||
|
|
||||||
#include "al-util.h"
|
#include "al-util.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct ALDataSource
|
struct ALDataSource
|
||||||
{
|
{
|
||||||
|
|
|
@ -612,15 +612,24 @@ Bitmap::Bitmap(Exception &exception, const char *filename)
|
||||||
if (shState->config().enableHires && filenameStd.compare(0, hiresPrefix.size(), hiresPrefix) != 0) {
|
if (shState->config().enableHires && filenameStd.compare(0, hiresPrefix.size(), hiresPrefix) != 0) {
|
||||||
// Look for a high-res version of the file.
|
// Look for a high-res version of the file.
|
||||||
std::string hiresFilename = hiresPrefix + filenameStd;
|
std::string hiresFilename = hiresPrefix + filenameStd;
|
||||||
try {
|
Exception e;
|
||||||
hiresBitmap = new Bitmap(hiresFilename.c_str());
|
hiresBitmap = new Bitmap(e, hiresFilename.c_str());
|
||||||
hiresBitmap->setLores(this);
|
if (e.is_error())
|
||||||
}
|
|
||||||
catch (const Exception &e)
|
|
||||||
{
|
{
|
||||||
Debug() << "No high-res Bitmap found at" << hiresFilename;
|
Debug() << "No high-res Bitmap found at" << hiresFilename;
|
||||||
|
delete hiresBitmap;
|
||||||
hiresBitmap = nullptr;
|
hiresBitmap = nullptr;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hiresBitmap->setLores(e, this);
|
||||||
|
if (e.is_error())
|
||||||
|
{
|
||||||
|
Debug() << "No high-res Bitmap found at" << hiresFilename;
|
||||||
|
delete hiresBitmap;
|
||||||
|
hiresBitmap = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // MKXPZ_RETRO
|
#endif // MKXPZ_RETRO
|
||||||
|
|
||||||
|
@ -2668,7 +2677,7 @@ void Bitmap::drawText(Exception &exception, const IntRect &rect, const char *str
|
||||||
GUARD(font = p->font->getSdlFont(exception));
|
GUARD(font = p->font->getSdlFont(exception));
|
||||||
#else
|
#else
|
||||||
TTF_Font *font;
|
TTF_Font *font;
|
||||||
GUARD(font = p->font->getSdlFont());
|
GUARD(font = p->font->getSdlFont(exception));
|
||||||
#endif // MKXPZ_RETRO
|
#endif // MKXPZ_RETRO
|
||||||
const Color &fontColor = p->font->getColor();
|
const Color &fontColor = p->font->getColor();
|
||||||
const Color &outColor = p->font->getOutColor();
|
const Color &outColor = p->font->getOutColor();
|
||||||
|
@ -2863,7 +2872,8 @@ IntRect Bitmap::textSize(Exception &exception, const char *str)
|
||||||
GUARD_V(IntRect(), rect = textRect(exception, str, p->font->isSolid()));
|
GUARD_V(IntRect(), rect = textRect(exception, str, p->font->isSolid()));
|
||||||
return IntRect(0, 0, rect.w, rect.h);
|
return IntRect(0, 0, rect.w, rect.h);
|
||||||
#else
|
#else
|
||||||
TTF_Font *font = p->font->getSdlFont();
|
TTF_Font *font;
|
||||||
|
GUARD_V(IntRect(), font = p->font->getSdlFont(exception));
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
TTF_SizeUTF8(font, str, &w, &h);
|
TTF_SizeUTF8(font, str, &w, &h);
|
||||||
|
@ -2899,7 +2909,7 @@ void Bitmap::setInitFont(Font *value)
|
||||||
if (hiresFont && hiresFont != &shState->defaultFont())
|
if (hiresFont && hiresFont != &shState->defaultFont())
|
||||||
{
|
{
|
||||||
// Disable the illegal font size check when creating a high-res font.
|
// Disable the illegal font size check when creating a high-res font.
|
||||||
hiresFont->setSize(hiresFont->getSize() * p->selfHires->width() / width(), false);
|
hiresFont->setSizeNoCheck(hiresFont->getSize() * p->selfHires->width() / width());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // MKXPZ_RETRO
|
#endif // MKXPZ_RETRO
|
||||||
|
|
12
src/main.cpp
12
src/main.cpp
|
@ -138,9 +138,9 @@ int rgssThreadFun(void *userdata) {
|
||||||
|
|
||||||
alcMakeContextCurrent(alcCtx);
|
alcMakeContextCurrent(alcCtx);
|
||||||
|
|
||||||
try {
|
Exception exc;
|
||||||
SharedState::initInstance(threadData);
|
SharedState::initInstance(exc, threadData);
|
||||||
} catch (const Exception &exc) {
|
if (exc.is_error()) {
|
||||||
rgssThreadError(threadData, exc.msg);
|
rgssThreadError(threadData, exc.msg);
|
||||||
alcDestroyContext(alcCtx);
|
alcDestroyContext(alcCtx);
|
||||||
|
|
||||||
|
@ -521,9 +521,9 @@ static SDL_GLContext initGL(SDL_Window *win, Config &conf,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
Exception exc;
|
||||||
initGLFunctions();
|
initGLFunctions(exc);
|
||||||
} catch (const Exception &exc) {
|
if (exc.is_error()) {
|
||||||
GLINIT_SHOWERROR(exc.msg);
|
GLINIT_SHOWERROR(exc.msg);
|
||||||
SDL_GL_DeleteContext(glCtx);
|
SDL_GL_DeleteContext(glCtx);
|
||||||
|
|
||||||
|
|
|
@ -149,20 +149,38 @@ struct SharedStatePrivate
|
||||||
std::string archPath = config.execName + gameArchExt();
|
std::string archPath = config.execName + gameArchExt();
|
||||||
|
|
||||||
for (size_t i = 0; i < config.patches.size(); ++i)
|
for (size_t i = 0; i < config.patches.size(); ++i)
|
||||||
fileSystem.addPath(config.patches[i].c_str());
|
{
|
||||||
|
Exception e;
|
||||||
|
fileSystem.addPath(e, config.patches[i].c_str());
|
||||||
|
if (e.is_error())
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if a game archive exists */
|
/* Check if a game archive exists */
|
||||||
FILE *tmp = fopen(archPath.c_str(), "rb");
|
FILE *tmp = fopen(archPath.c_str(), "rb");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
{
|
{
|
||||||
fileSystem.addPath(archPath.c_str());
|
Exception e;
|
||||||
|
fileSystem.addPath(e, archPath.c_str());
|
||||||
fclose(tmp);
|
fclose(tmp);
|
||||||
|
if (e.is_error())
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileSystem.addPath(".");
|
{
|
||||||
|
Exception e;
|
||||||
|
fileSystem.addPath(e, ".");
|
||||||
|
if (e.is_error())
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < config.rtps.size(); ++i)
|
for (size_t i = 0; i < config.rtps.size(); ++i)
|
||||||
fileSystem.addPath(config.rtps[i].c_str());
|
{
|
||||||
|
Exception e;
|
||||||
|
fileSystem.addPath(e, config.rtps[i].c_str());
|
||||||
|
if (e.is_error())
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.pathCache)
|
if (config.pathCache)
|
||||||
fileSystem.createPathCache();
|
fileSystem.createPathCache();
|
||||||
|
|
Loading…
Add table
Reference in a new issue