Replacing standart C library methods with SDL methods

This commit is contained in:
niko(depressedTWM) 2026-07-14 12:43:43 -04:00
parent 319e17d711
commit e14614a7a9
124 changed files with 230 additions and 231 deletions

View file

@ -81,7 +81,7 @@ set(MAIN_HEADERS
src/define.h
src/signals/signal.h
src/signals/signalconnection.h
src/signals/rubyDispatcher.h
src/signals/rubydispatcher.h
)
set(MAIN_SOURCE
@ -128,7 +128,7 @@ set(MAIN_SOURCE
src/modloader.cpp
src/sunshine.cpp
src/lightmap.cpp
src/signals/rubyDispatcher.cpp
src/signals/rubydispatcher.cpp
)
if(WIN32)

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -248,7 +248,7 @@ RB_METHOD(mkxpRawKeyStates){
RB_UNUSED_PARAM;
VALUE str = rb_str_new(0, sizeof(EventThread::keyStates));
memcpy(RSTRING_PTR(str), EventThread::keyStates, sizeof(EventThread::keyStates));
SDL_memcpy(RSTRING_PTR(str), EventThread::keyStates, sizeof(EventThread::keyStates));
return str;
}
@ -468,7 +468,7 @@ static void runRMXPScripts(BacktraceData &btData){
char buf[512];
int len;
len = snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName);
len = SDL_snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName);
fname = newStringUTF8(buf, len);
btData.scriptNames.insert(buf, scriptName);
@ -505,7 +505,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
char line[16];
std::string file(512, '\0');
char *p = s + strlen(s);
char *p = s + SDL_strlen(s);
char *e;
while (p != s)
@ -535,7 +535,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
*e = ':';
/* Shrink to fit */
file.resize(strlen(file.c_str()));
file.resize(SDL_strlen(file.c_str()));
file = btData.scriptNames.value(file, file);
crash(Exception::MEOW, "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -85,7 +85,7 @@ void raiseDisposedAccess(VALUE self){
char buf[32];
strncpy(buf, klassName, sizeof(buf));
buf[0] = tolower(buf[0]);
buf[0] = SDL_tolower(buf[0]);
rb_raise(getRbData()->exc[RGSS], "disposed %s", buf);
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -24,7 +24,7 @@
#include <ruby.h>
//костыль ебаный сука
#undef snprintf
#undef SDL_snprintf
#undef inline
#include "exception.h"
@ -167,14 +167,14 @@ static inline void _rb_define_module_function(VALUE module, const char *name, Ru
rb_define_module_function(module, name, RUBY_METHOD_FUNC(func), -1);
}
#define GUARD_EXC(exp) \
{ try { exp } catch (const Exception &exc) { raiseRbExc(exc); } }
#define GUARD_EXC(SDL_exp) \
{ try { SDL_exp } catch (const Exception &exc) { raiseRbExc(exc); } }
#define GFX_GUARD_EXC(exp) \
#define GFX_GUARD_EXC(SDL_exp) \
{\
GFX_LOCK; \
try {\
exp \
SDL_exp \
} catch (const Exception &exc) {\
GFX_UNLOCK; \
raiseRbExc(exc); \

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -94,14 +94,14 @@ RB_METHOD(journalSet){
rb_get_args(argc, argv, "z", &name RB_ARG_END);
// Record message
SDL_LockMutex(mutex);
message_len = strlen(name);
message_len = SDL_strlen(name);
strcpy((char*)message_buffer, name);
if (message_len > 0) {
// in the case where journal is being sent empty string
// do not append the language suffix, because empty string
// is the signifier to terminate the journal
strcpy((char*)message_buffer + message_len, (char*)lang_buffer);
message_len += strlen((char*)lang_buffer);
message_len += SDL_strlen((char*)lang_buffer);
}
SDL_UnlockMutex(mutex);
@ -162,7 +162,7 @@ RB_METHOD(journalActive){
void journalBindingInit(){
mutex = SDL_CreateMutex();
memset((char*)lang_buffer, 0, BUFFER_SIZE);
SDL_memset((char*)lang_buffer, 0, BUFFER_SIZE);
lang_buffer[0] = '_';
#if defined __linux
mkfifo(PIPE_PATH.c_str(), 0666);

View file

@ -155,7 +155,7 @@ RB_METHOD(nikoStart){
wcscat(path, L"\\_______.exe");
wsprintfW(args, L"_______.exe %d %d", pos.x, pos.y);
STARTUPINFOW si;
memset(&si, 0, sizeof(si));
SDL_memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
@ -169,7 +169,7 @@ RB_METHOD(nikoStart){
sprintf(message, "%d,%d\n", x, y);
SDL_LockMutex(mutex);
message_len = strlen(message);
message_len = SDL_strlen(message);
strcpy((char*)message_buffer, message);
SDL_UnlockMutex(mutex);

View file

@ -6,7 +6,9 @@
#include "eventthread.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_stdinc.h>
#include <boost/crc.hpp>
#include <stdlib.h>
RB_METHOD(oneshotSetYesNo){
RB_UNUSED_PARAM;
@ -71,11 +73,11 @@ RB_METHOD(oneshotShake){
int absx, absy;
SDL_GetWindowPosition(shState->rtData().window, &absx, &absy);
int state;
srand(time(NULL));
SDL_srand(time(NULL));
for (int i = 0; i < 60; ++i) {
int max = 60 - i;
int x = rand() % (max * 2) - max;
int y = rand() % (max * 2) - max;
int x = SDL_rand(RAND_MAX) % (max * 2) - max;
int y = SDL_rand(RAND_MAX) % (max * 2) - max;
SDL_SetWindowPosition(shState->rtData().window, absx + x, absy + y);
rb_eval_string_protect("sleep 0.02", &state);
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -18,12 +18,12 @@ static void start(){
MultiByteToWideChar(CP_UTF8, 0, shState->config().gameFolder.c_str(), -1, gameFolder, MAX_PATH);
GetModuleFileNameW(NULL, path, MAX_PATH);
STARTUPINFOW si;
memset(&si, 0, sizeof(si));
SDL_memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
std::wstring argString = std::wstring(L"oneshot.exe \"--gameFolder=") + gameFolder + L"\" --screenMode=true";
WCHAR *args = new WCHAR[argString.size() + 1];
memcpy(args, argString.c_str(), (argString.size() + 1) * sizeof(WCHAR));
SDL_memcpy(args, argString.c_str(), (argString.size() + 1) * sizeof(WCHAR));
CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
delete [] args;
#else
@ -66,7 +66,7 @@ RB_METHOD(screenSet){
rb_get_args(argc, argv, "z", &imageName RB_ARG_END);
if (!ipc.isOpen())
start();
ipc.write(imageName, strlen(imageName) + 1);
ipc.write(imageName, SDL_strlen(imageName) + 1);
return Qnil;
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -1,6 +1,6 @@
#include <ruby.h>
#include <time.h>
#include <math.h>
#include <SDL3/SDL_stdinc.h>
static VALUE get_month(VALUE self) {
time_t now = time(NULL);
@ -24,7 +24,7 @@ static VALUE ctime_at(int argc, VALUE *argv, VALUE self){
if (TYPE(v_sec) == T_FLOAT || rb_obj_is_kind_of(v_sec, rb_cFloat)) {
dsec = NUM2DBL(v_sec);
sec = (long long) floor(dsec);
sec = (long long) SDL_floor(dsec);
double frac = dsec - (double)sec;
nsec = (long) llround(frac * 1e9);
if (nsec >= 1000000000L) { sec += 1; nsec -= 1000000000L; }

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,6 +5,7 @@
#include <map>
#include <boost/algorithm/string/replace.hpp>
#include <SDL3/SDL_stdinc.h>
#include "etc.h"
#include "sharedstate.h"
#include "binding-util.h"
@ -71,7 +72,7 @@
return;
}
if (desktop == "lxde"){
const char* homeC = std::getenv("HOME");
const char* homeC = SDL_getenv("HOME");
if (!homeC) return;
std::string home(homeC);
std::string path = home + "/.config/pcmanfm/LXDE/desktop-items-0.conf";
@ -146,7 +147,7 @@
}
} else if (desktop == "kde") {
std::ifstream configFile;
configFile.open(std::string(getenv("HOME")) + "/.config/plasma-org.kde.plasma.desktop-appletsrc", std::ios::in);
configFile.open(std::string(SDL_getenv("HOME")) + "/.config/plasma-org.kde.plasma.desktop-appletsrc", std::ios::in);
if (configFile.is_open()) {
std::string line;
std::vector<std::string> sections;
@ -211,7 +212,7 @@
desktop = "kde_error";
}
} else {
fallbackPath = std::string(getenv("HOME")) + "/Desktop/ONESHOT_hint.png";
fallbackPath = std::string(SDL_getenv("HOME")) + "/Desktop/ONESHOT_hint.png";
}
}
#endif

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -34,7 +34,7 @@ static void loadImage(const char *name) {
}
// handle default as a special case, since we'll keep that image internally
if (strcmp(name, "default") == 0) {
if (SDL_strcmp(name, "default") == 0) {
image_handle = LoadBitmapA(GetModuleHandleW(NULL), "default");
}
else {
@ -46,7 +46,7 @@ static void loadImage(const char *name) {
char* langCode = 0;
char* emptyString = "\0";
strcpy(imageName, name);
langCode = strchr(imageName, '_');
langCode = SDL_strchr(imageName, '_');
if (langCode > 0) {
// replace the code with 0 to null terminate the image name where this is
// then use the rest of the string as the language code
@ -169,8 +169,8 @@ void init_check_save(WCHAR* save_path) {
fread(langbuf, 1, 16, savefile);
fclose(savefile);
openbrace = strchr(langbuf, '[');
closebrace = strchr(langbuf, ']');
openbrace = SDL_strchr(langbuf, '[');
closebrace = SDL_strchr(langbuf, ']');
if (openbrace && closebrace && openbrace < closebrace) {
//we very probably have a language code here.
//so, lets do some hacky string manipulation to
@ -189,7 +189,7 @@ void init_check_save(WCHAR* save_path) {
// so we need a gamepath, which should be saved in the registry
boolean readGamePath() {
// clear data path
memset(&DataPath[0], 0, sizeof(DataPath));
SDL_memset(&DataPath[0], 0, sizeof(DataPath));
DWORD dataPathSize = sizeof(DataPath);
HKEY key;

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -200,7 +200,7 @@ struct ALStreamOpenHandler : FileSystem::OpenHandler{
SDL_SeekIO(srcOps, 0, SDL_IO_SEEK_SET);
try{
if (!strcmp(sig, "OggS")){
if (!SDL_strcmp(sig, "OggS")){
source = createVorbisSource(*srcOps, looped);
return true;
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -960,9 +960,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align){
SDL_Surface *txtSurf;
if (shState->rtData().config.solidFonts)
txtSurf = TTF_RenderText_Solid(font, str, strlen(str), c);
txtSurf = TTF_RenderText_Solid(font, str, SDL_strlen(str), c);
else
txtSurf = TTF_RenderText_Blended(font, str, strlen(str), c);
txtSurf = TTF_RenderText_Blended(font, str, SDL_strlen(str), c);
p->ensureFormat(txtSurf, SDL_PIXELFORMAT_ABGR8888);
@ -980,9 +980,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align){
/* set the next font render to render the outline */
TTF_SetFontOutline(font, OUTLINE_SIZE);
if (shState->rtData().config.solidFonts)
outline = TTF_RenderText_Solid(font, str, strlen(str), co);
outline = TTF_RenderText_Solid(font, str, SDL_strlen(str), co);
else
outline = TTF_RenderText_Blended(font, str, strlen(str), co);
outline = TTF_RenderText_Blended(font, str, SDL_strlen(str), co);
p->ensureFormat(outline, SDL_PIXELFORMAT_ABGR8888);
SDL_Rect outRect = {OUTLINE_SIZE, OUTLINE_SIZE, txtSurf->w, txtSurf->h};
@ -1182,7 +1182,7 @@ IntRect Bitmap::textSize(const char *str){
str = fixed.c_str();
// i don't know if its right migration, i didn't find any other way
TTF_Text* text = TTF_CreateText(NULL, font, str, strlen(str));
TTF_Text* text = TTF_CreateText(NULL, font, str, SDL_strlen(str));
int w, h;
TTF_GetTextSize(text, &w, &h);

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -97,7 +97,7 @@ void Config::read(int argc, char *argv[]){
PO_DESC(pancakes, bool, false)
// Not gonna take your shit boost
#define GUARD_ALL( exp ) try { exp } catch(...) {}
#define GUARD_ALL( SDL_exp ) try { SDL_exp } catch(...) {}
editor.debug = false;
editor.battleTest = false;

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -27,7 +27,7 @@
#include <vector>
#ifdef __ANDROID__
#include <android/log.h>
#include <android/SDL_log.h>
#elif __EMSCRIPTEN__
#include <emscripten/console.h>
#endif

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -61,7 +61,7 @@ struct ALCFunctions{
} static alc;
static void initALCFunctions(ALCdevice *alcDev){
if (!strstr(alcGetString(alcDev, ALC_EXTENSIONS), "ALC_SOFT_pause_device"))
if (!SDL_strstr(alcGetString(alcDev, ALC_EXTENSIONS), "ALC_SOFT_pause_device"))
return;
Debug() << "ALC_SOFT_pause_device present";
@ -605,7 +605,7 @@ void EventThread::showMessageBox(const char *body, int flags){
SDL_Event event;
event.user.code = flags;
event.user.data1 = strdup(body);
event.user.data1 = SDL_strdup(body);
event.type = usrIdStart + REQUEST_MESSAGEBOX;
SDL_PushEvent(&event);

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -22,9 +22,8 @@
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <SDL3/SDL_stdinc.h>
#include <string>
#include <stdio.h>
#include <stdarg.h>
struct Exception{
enum Type{
@ -51,14 +50,12 @@ struct Exception{
Type type;
std::string msg;
Exception(Type type, const char *format, ...)
: type(type)
{
Exception(Type type, const char *format, ...) : type(type){
va_list ap;
va_start(ap, format);
msg.resize(512);
vsnprintf(&msg[0], msg.size(), format, ap);
SDL_vsnprintf(&msg[0], msg.size(), format, ap);
va_end(ap);
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -255,7 +255,7 @@ static void initReadOps(PHYSFS_File *handle, SDL_IOStream* &ops){
static void strTolower(std::string &str){
for (size_t i = 0; i < str.size(); ++i)
str[i] = tolower(str[i]);
str[i] = SDL_tolower(str[i]);
}
// const Uint32 SDL_RWOPS_PHYSFS = SDL_RWOPS_UNKNOWN+10;
@ -416,7 +416,7 @@ static PHYSFS_EnumerateCallbackResult fontSetEnumCB (void *data, const char *dir
size_t i;
for (i = 0; i < sizeof(lowExt)-1 && ext[i]; ++i)
lowExt[i] = tolower(ext[i]);
lowExt[i] = SDL_tolower(ext[i]);
lowExt[i] = '\0';
if (SDL_strcmp(lowExt, "ttf") && SDL_strcmp(lowExt, "otf") && SDL_strcmp(lowExt, "ttc"))
@ -536,7 +536,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){
if (p->havePathCache)
for (size_t i = 0; i < len; ++i)
buffer[i] = tolower(buffer[i]);
buffer[i] = SDL_tolower(buffer[i]);
/* Find the deliminator separating directory and file name */
for (delim = buffer + len; delim > buffer; --delim)

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -80,7 +80,7 @@ void initGLFunctions(){
bool gles = false;
if (!strncmp(ver, glesPrefix, glesPrefixN)){
if (!SDL_strncmp(ver, glesPrefix, glesPrefixN)){
gles = true;
gl.glsles = true;

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -70,7 +70,7 @@ void loadLanguageMetadata() {
// char line[256];
char line[1024];
languageMetadata = (LanguageFontAndSize**) calloc(MAX_LANGUAGES, sizeof(LanguageFontAndSize*));
languageMetadata = (LanguageFontAndSize**) SDL_calloc(MAX_LANGUAGES, sizeof(LanguageFontAndSize*));
FILE* fontsFile = fopen("Languages/internal/language_fonts.ini", "r");
if (fontsFile) {
@ -125,12 +125,12 @@ void loadLanguageMetadata() {
char* indexOfFontSize = indexOfEquals + 1;
// remove new line from end of font size
char* indexOfNewLine = strchr(indexOfFontSize, '\n');
char* indexOfNewLine = SDL_strchr(indexOfFontSize, '\n');
if (indexOfNewLine) {
indexOfNewLine[0] = 0;
}
int fontSize = atoi(indexOfFontSize);
int fontSize = SDL_atoi(indexOfFontSize);
for (int i = 0; i < MAX_LANGUAGES; i++) {
// search for corresponding langCode in metadata array to populate font size in the appropriate metadata
@ -201,7 +201,7 @@ void loadLocale(const char* locale) {
int lineLen = SDL_strlen(lineWithoutMsgid);
strdict[nStr] = (char*)malloc(lineLen + 1);
strdict[nStr] = (char*)SDL_malloc(lineLen + 1);
SDL_strlcpy(strdict[nStr], lineWithoutMsgid, sizeof(lineWithoutMsgid));
nStr++;

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -204,7 +204,7 @@ static void setGamePathInRegistry() {
WarnMsg("Unable to open registry.");
}
else {
DWORD dataSize = (strlen(dataDir) + 1) * sizeof(char);
DWORD dataSize = (SDL_strlen(dataDir) + 1) * sizeof(char);
if (RegSetValueEx(key, TEXT("GameDirectory"), 0, REG_SZ, (LPBYTE)dataDir, dataSize) != ERROR_SUCCESS){
WarnMsg("Unable to set GameDirectory registry value");
}

View file

@ -55,7 +55,7 @@ void crash(Exception::Type t, const char *fmt, ...){
char *buf = (char*)SDL_malloc((size_t)len + 1);
SDL_vsnprintf(buf, (size_t)len + 1, fmt, args);
va_end(args);
SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash log? You can share the crash log with the developers and help resolve the issue.", buf);
SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash SDL_log? You can share the crash SDL_log with the developers and help resolve the issue.", buf);
SDL_MessageBoxData messageboxdata = {
.flags = SDL_MESSAGEBOX_ERROR,
.window = NULL,
@ -111,8 +111,8 @@ void crash(Exception::Type t, const char *fmt, ...){
}catch(const std::exception& e){
o << "Detected OS: " << e.what() << std::endl;
}
if(!getenv("XDG_CURRENT_DESKTOP") == NULL){
o << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << getenv("XDG_CURRENT_DESKTOP") << std::endl;
if(!SDL_getenv("XDG_CURRENT_DESKTOP") == NULL){
o << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << SDL_getenv("XDG_CURRENT_DESKTOP") << std::endl;
}
#ifdef __ANDROID__
o << "Android API version: " << android_get_device_api_level() << std::endl;
@ -130,7 +130,7 @@ void crash(Exception::Type t, const char *fmt, ...){
o << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl;
o << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl;
o << "Emscripten current stack pointer: " << emscripten_stack_get_current() << std::endl;
o << "Emscripten number of free bytes left on stack: " << emscripten_stack_get_free() << std::endl;
o << "Emscripten number of SDL_free bytes left on stack: " << emscripten_stack_get_free() << std::endl;
#elif __PSP__
o << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl;
#endif

View file

@ -92,7 +92,7 @@ std::string sha256_file(const std::string &fn) {
out.reserve(SHA256_DIGEST_LENGTH * 2);
char hex[3] = {0};
for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
snprintf(hex, sizeof hex, "%02x", hash[i]);
SDL_snprintf(hex, sizeof hex, "%02x", hash[i]);
out += hex;
}
return out;

View file

@ -239,8 +239,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData)
p->journal = "_______.exe";
#else
// Get language code
const char *lc_all = getenv("LC_ALL");
const char *lang = getenv("LANG");
const char *lc_all = SDL_getenv("LC_ALL");
const char *lang = SDL_getenv("LANG");
const char *code = (lc_all ? lc_all : lang);
if (code)
{
@ -277,7 +277,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData)
// Get documents path
#ifdef __APPLE__
std::string path = std::string(getenv("HOME")) + "/Documents";
std::string path = std::string(SDL_getenv("HOME")) + "/Documents";
p->docsPath = path.c_str();
p->gamePath = path.c_str();
p->journal = "_______.app";
@ -293,7 +293,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData)
Debug() << "[oneshot] Docs path :" << p->docsPath;
#ifdef unix_like
char const *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
char const *xdg_current_desktop = SDL_getenv("XDG_CURRENT_DESKTOP");
gtk_init(0, 0);
if (xdg_current_desktop == NULL)
@ -303,7 +303,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData)
else
{
std::string desktop(xdg_current_desktop);
std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::tolower);
std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::SDL_tolower);
if (desktop.find("cinnamon") != std::string::npos)
{
desktopEnv = "cinnamon";

View file

@ -95,7 +95,7 @@ public:
{
#ifdef _WIN32
OVERLAPPED overlapped;
memset(&overlapped, 0, sizeof(overlapped));
SDL_memset(&overlapped, 0, sizeof(overlapped));
if (!ReadFile(handle, buf, 1, NULL, &overlapped)){
if (GetLastError() == ERROR_IO_PENDING)
CancelIo(handle);

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -39,7 +39,7 @@
#include "signals/signal.h"
static float fwrap(float value, float range){
float res = fmod(value, range);
float res = SDL_fmod(value, range);
return res < 0 ? res + range : res;
}
@ -133,8 +133,8 @@ struct PlanePrivate{
int vph = sceneGeo.rect.h;
/* Amount the scaled bitmap is tiled (repeated) */
size_t tilesX = ceil((vpw - sw + wox) / sw) + 1;
size_t tilesY = ceil((vph - sh + woy) / sh) + 1;
size_t tilesX = SDL_ceil((vpw - sw + wox) / sw) + 1;
size_t tilesY = SDL_ceil((vph - sh + woy) / sh) + 1;
FloatRect tex = srcRect->toFloatRect();

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -22,8 +22,7 @@
#include "rgssad.h"
#include "boost-hash.h"
#include <stdint.h>
#include <string.h>
#include <SDL3/SDL_stdinc.h>
struct RGSS_entryData{
int64_t offset;
@ -143,7 +142,7 @@ static PHYSFS_sint64 RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 le
/* Shift them back to normal */
dword >>= 8 * (offs % 4);
memcpy(bBufferP, &dword, preAlign);
SDL_memcpy(bBufferP, &dword, preAlign);
bBufferP += preAlign;
@ -173,7 +172,7 @@ static PHYSFS_sint64 RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 le
/* Bytes are already aligned with magic */
dword ^= entry->currentMagic;
memcpy(bBufferP, &dword, postAlign);
SDL_memcpy(bBufferP, &dword, postAlign);
}
entry->currentOffset += toRead;
@ -291,7 +290,7 @@ static bool verifyHeader(PHYSFS_Io *io, char version){
if (!IO_READ(io, header, sizeof(header)))
return false;
if (strcmp(header, RGSS_HEADER))
if (SDL_strcmp(header, RGSS_HEADER))
return false;
if (header[7] != version)

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -93,7 +93,7 @@ protected:
/* A bit about OpenGL state:
*
* If we're not inside the draw cycle (ie. the 'draw()'
* handle), you're free to change any GL state through
* handle), you're SDL_free to change any GL state through
* gl-util, except for those in GLState which you should
* push/pop as needed.
*
@ -101,7 +101,7 @@ protected:
* things in GLState. For scissored rendering, use push with
* setIntersect(), and then pop afterwards.
* Blendmode you can push/pop as you like. Do NOT touch viewport.
* Texture/Shader bindings you're free to modify without
* Texture/Shader bindings you're SDL_free to modify without
* cleanup (and therefore you should expect dirty state).
* Do NOT touch the FBO::Draw binding. If you have to do work
* immediately before drawing that touches this (such as flushing

View file

@ -56,7 +56,7 @@ int screenMain(Config &conf){
// Change shape
if (readMessage(ipc, messageBuf, sizeof(messageBuf))) {
if (strcmp(messageBuf, "END") == 0)
if (SDL_strcmp(messageBuf, "END") == 0)
break;
std::string imgname = conf.gameFolder + "/Journal/" + messageBuf + ".png";
SDL_DestroySurface(shape);

View file

@ -101,7 +101,7 @@ private:
char *start = base;
if (eback() == base){
memmove(base, egptr() - pbSize, pbSize);
SDL_memmove(base, egptr() - pbSize, pbSize);
start += pbSize;
}
//size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size);

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -34,7 +34,7 @@
static inline int32_t readInt32(const char **dataP){
int32_t result;
memcpy(&result, *dataP, 4);
SDL_memcpy(&result, *dataP, 4);
*dataP += 4;
return result;
@ -43,19 +43,19 @@ static inline int32_t readInt32(const char **dataP){
static inline double readDouble(const char **dataP){
double result;
memcpy(&result, *dataP, 8);
SDL_memcpy(&result, *dataP, 8);
*dataP += 8;
return result;
}
static inline void writeInt32(char **dataP, int32_t value){
memcpy(*dataP, &value, 4);
SDL_memcpy(*dataP, &value, 4);
*dataP += 4;
}
static inline void writeDouble(char **dataP, double value){
memcpy(*dataP, &value, 8);
SDL_memcpy(*dataP, &value, 8);
*dataP += 8;
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -72,20 +72,20 @@ static void printShaderLog(GLuint shader){
GLint logLength;
gl.GetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
std::string log(logLength, '\0');
gl.GetShaderInfoLog(shader, log.size(), 0, &log[0]);
std::string SDL_log(logLength, '\0');
gl.GetShaderInfoLog(shader, SDL_log.size(), 0, &SDL_log[0]);
Debug() << "Shader log:\n" << log;
Debug() << "Shader SDL_log:\n" << SDL_log;
}
static void printProgramLog(GLuint program){
GLint logLength;
gl.GetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);
std::string log(logLength, '\0');
gl.GetProgramInfoLog(program, log.size(), 0, &log[0]);
std::string SDL_log(logLength, '\0');
gl.GetProgramInfoLog(program, SDL_log.size(), 0, &SDL_log[0]);
Debug() << "Program log:\n" << log;
Debug() << "Program SDL_log:\n" << SDL_log;
}
Shader::Shader(){

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.
@ -119,7 +119,7 @@ void SoundEmitter::play(const std::string &filename, int volume, int pitch) {
if (!buffer)
return;
/* Try to find first free source */
/* Try to find first SDL_free source */
size_t i;
for (i = 0; i < srcCount; ++i)
if (AL::Source::getState(alSrcs[srcPrio[i]]) != AL_PLAYING)

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** mkxp is SDL_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.

Some files were not shown because too many files have changed in this diff Show more