no message
This commit is contained in:
parent
e8dd4b8872
commit
d1c8a93d5c
26
src/fs.c
26
src/fs.c
|
@ -106,13 +106,12 @@ bool fsIsInPublicDir(FileSystem* fs)
|
|||
|
||||
#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
|
||||
|
||||
// #define UTF8ToString(S) (wchar_t *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), strlen(S)+1)
|
||||
// #define StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (wcslen(S)+1)*sizeof(wchar_t))
|
||||
#define __S(x) L ## x
|
||||
#define _S(x) __S(x)
|
||||
|
||||
static const wchar_t* UTF8ToString(const char* str)
|
||||
{
|
||||
// TODO: ugly hack
|
||||
wchar_t* wstr = calloc(1, FILENAME_MAX * sizeof(wchar_t));
|
||||
static wchar_t wstr[FILENAME_MAX];
|
||||
|
||||
mbstowcs(wstr, str, FILENAME_MAX);
|
||||
|
||||
|
@ -121,8 +120,7 @@ static const wchar_t* UTF8ToString(const char* str)
|
|||
|
||||
static char* StringToUTF8(const wchar_t* wstr)
|
||||
{
|
||||
// TODO: ugly hack
|
||||
char* str = calloc(1, FILENAME_MAX);
|
||||
static char str[FILENAME_MAX];
|
||||
|
||||
wcstombs(str, wstr, FILENAME_MAX);
|
||||
|
||||
|
@ -147,6 +145,8 @@ int _wremove(const wchar_t *);
|
|||
|
||||
#else
|
||||
|
||||
#define _S(x) (x)
|
||||
|
||||
#define UTF8ToString(S) (S)
|
||||
#define StringToUTF8(S) (S)
|
||||
|
||||
|
@ -380,7 +380,7 @@ static void onAddFile(const char* name, const u8* buffer, s32 size, void* data,
|
|||
{
|
||||
const char* destname = getFilePath(fs, name);
|
||||
|
||||
FILE* file = tic_fopen(UTF8ToString(destname), UTF8ToString("rb"));
|
||||
FILE* file = tic_fopen(UTF8ToString(destname), _S("rb"));
|
||||
if(file)
|
||||
{
|
||||
fclose(file);
|
||||
|
@ -390,7 +390,7 @@ static void onAddFile(const char* name, const u8* buffer, s32 size, void* data,
|
|||
else
|
||||
{
|
||||
const char* path = getFilePath(fs, name);
|
||||
FILE* dest = tic_fopen(UTF8ToString(path), UTF8ToString("wb"));
|
||||
FILE* dest = tic_fopen(UTF8ToString(path), _S("wb"));
|
||||
|
||||
if (dest)
|
||||
{
|
||||
|
@ -601,7 +601,7 @@ void fsGetFile(FileSystem* fs, GetCallback callback, const char* name, void* dat
|
|||
|
||||
bool fsWriteFile(const char* name, const void* buffer, s32 size)
|
||||
{
|
||||
FILE* file = tic_fopen(UTF8ToString(name), UTF8ToString("wb"));
|
||||
FILE* file = tic_fopen(UTF8ToString(name), _S("wb"));
|
||||
|
||||
if(file)
|
||||
{
|
||||
|
@ -626,7 +626,7 @@ bool fsCopyFile(const char* src, const char* dst)
|
|||
s32 size = 0;
|
||||
|
||||
{
|
||||
FILE* file = tic_fopen(UTF8ToString(src), UTF8ToString("rb"));
|
||||
FILE* file = tic_fopen(UTF8ToString(src), _S("rb"));
|
||||
if(file)
|
||||
{
|
||||
fseek(file, 0, SEEK_END);
|
||||
|
@ -641,7 +641,7 @@ bool fsCopyFile(const char* src, const char* dst)
|
|||
|
||||
if(buffer)
|
||||
{
|
||||
FILE* file = tic_fopen(UTF8ToString(dst), UTF8ToString("wb"));
|
||||
FILE* file = tic_fopen(UTF8ToString(dst), _S("wb"));
|
||||
|
||||
if(file)
|
||||
{
|
||||
|
@ -659,7 +659,7 @@ bool fsCopyFile(const char* src, const char* dst)
|
|||
|
||||
void* fsReadFile(const char* path, s32* size)
|
||||
{
|
||||
FILE* file = tic_fopen(UTF8ToString(path), UTF8ToString("rb"));
|
||||
FILE* file = tic_fopen(UTF8ToString(path), _S("rb"));
|
||||
void* buffer = NULL;
|
||||
|
||||
if(file)
|
||||
|
@ -855,7 +855,7 @@ void* fsLoadFile(FileSystem* fs, const char* name, s32* size)
|
|||
}
|
||||
else
|
||||
{
|
||||
FILE* file = tic_fopen(UTF8ToString(getFilePath(fs, name)), UTF8ToString("rb"));
|
||||
FILE* file = tic_fopen(UTF8ToString(getFilePath(fs, name)), _S("rb"));
|
||||
void* ptr = NULL;
|
||||
|
||||
if(file)
|
||||
|
|
44
src/system.c
44
src/system.c
|
@ -89,16 +89,15 @@ static void initSound()
|
|||
}
|
||||
}
|
||||
|
||||
static u8* _getSpritePtr(tic_tile* tiles, s32 x, s32 y)
|
||||
static u8* getSpritePtr(tic_tile* tiles, s32 x, s32 y)
|
||||
{
|
||||
enum { SheetCols = (TIC_SPRITESHEET_SIZE / TIC_SPRITESIZE) };
|
||||
return tiles[x / TIC_SPRITESIZE + y / TIC_SPRITESIZE * SheetCols].data;
|
||||
}
|
||||
|
||||
static u8 _getSpritePixel(tic_tile* tiles, s32 x, s32 y)
|
||||
static u8 getSpritePixel(tic_tile* tiles, s32 x, s32 y)
|
||||
{
|
||||
// TODO: check spritesheet rect
|
||||
return tic_tool_peek4(_getSpritePtr(tiles, x, y), (x % TIC_SPRITESIZE) + (y % TIC_SPRITESIZE) * TIC_SPRITESIZE);
|
||||
return tic_tool_peek4(getSpritePtr(tiles, x, y), (x % TIC_SPRITESIZE) + (y % TIC_SPRITESIZE) * TIC_SPRITESIZE);
|
||||
}
|
||||
|
||||
static void setWindowIcon()
|
||||
|
@ -113,7 +112,7 @@ static void setWindowIcon()
|
|||
for(s32 j = 0, index = 0; j < Size; j++)
|
||||
for(s32 i = 0; i < Size; i++, index++)
|
||||
{
|
||||
u8 color = _getSpritePixel(platform.studio->tic->config.bank0.tiles.data, i/Scale, j/Scale);
|
||||
u8 color = getSpritePixel(platform.studio->tic->config.bank0.tiles.data, i/Scale, j/Scale);
|
||||
pixels[index] = color == ColorKey ? 0 : pal[color];
|
||||
}
|
||||
|
||||
|
@ -238,34 +237,6 @@ static void calcTextureRect(SDL_Rect* rect)
|
|||
}
|
||||
}
|
||||
|
||||
// static void processGesture()
|
||||
// {
|
||||
// SDL_TouchID id = SDL_GetTouchDevice(0);
|
||||
// s32 fingers = SDL_GetNumTouchFingers(id);
|
||||
|
||||
// enum{Fingers = 2};
|
||||
|
||||
// if(fingers == Fingers)
|
||||
// {
|
||||
// tic_point point = {0, 0};
|
||||
|
||||
// for(s32 f = 0; f < fingers; f++)
|
||||
// {
|
||||
// SDL_Finger* finger = SDL_GetTouchFinger(id, 0);
|
||||
|
||||
// point.x += (s32)(finger->x * TIC80_WIDTH);
|
||||
// point.y += (s32)(finger->y * TIC80_HEIGHT);
|
||||
// }
|
||||
|
||||
// point.x /= Fingers;
|
||||
// point.y /= Fingers;
|
||||
|
||||
// platform.gesture.pos = point;
|
||||
|
||||
// platform.gesture.active = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
static void processMouse()
|
||||
{
|
||||
s32 mx = 0, my = 0;
|
||||
|
@ -601,11 +572,6 @@ static void pollEvent()
|
|||
}
|
||||
}
|
||||
|
||||
// if(platform.mode != TIC_RUN_MODE)
|
||||
// processGesture();
|
||||
|
||||
// if(!platform.gesture.active)
|
||||
|
||||
processMouse();
|
||||
processKeyboard();
|
||||
processGamepad();
|
||||
|
@ -943,8 +909,6 @@ static void openSystemPath(const char* path)
|
|||
|
||||
sprintf(command, "explorer \"%s\"", path);
|
||||
|
||||
printf("%s\n", command);
|
||||
|
||||
wchar_t wcommand[FILENAME_MAX];
|
||||
mbstowcs(wcommand, command, FILENAME_MAX);
|
||||
|
||||
|
|
Loading…
Reference in New Issue