isle-portable/ISLE/isleapp.h
AllMeatball c48935a64b
Create config with sane defaults if not already present (#71)
* Create config with sane defaults if not present

* isleapp: Use binary mode for iniFP

Windows treats newlines differently then on *nix systems. Using binary mode makes this consistent.

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* isleapp: Remove extern "C"

It seems like it's fine including these libraries without extern "C"

* isleapp: Use boolean return in LoadConfig

This to check if the config loaded correctly or not.
Seems to be a good solution to the file loading issue.

Maybe there's a better solution
SetupWindow failing because of a config erroring seems a bit odd.

* isleapp: Remove that dumb use after free.

I forgot you don't specify a filename you specify a *file pointer*

* isleapp: Fix iniFP to be in proper scope

This also fixes the missing parameter in `iniparser_dump_ini`

* .gitignore: Exclude the kate .cache folder

* isleapp: Match prototype of LoadConfig in header

* isleapp: Fix formating to comply with .clang-format

* isleapp: Don't create new config if manually set

---------

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2025-05-12 17:25:16 -07:00

91 lines
2.3 KiB
C++

#ifndef ISLEAPP_H
#define ISLEAPP_H
#include "lego1_export.h"
#include "legoutils.h"
#include "mxtypes.h"
#include "mxvideoparam.h"
#include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_video.h>
#ifdef _WIN32
#include <windows.h>
#else
#include "miniwin.h"
#endif
// SIZE 0x8c
class IsleApp {
public:
IsleApp();
~IsleApp();
void Close();
MxS32 SetupLegoOmni();
void SetupVideoFlags(
MxS32 fullScreen,
MxS32 flipSurfaces,
MxS32 backBuffers,
MxS32 using8bit,
MxS32 using16bit,
MxS32 param_6,
MxS32 param_7,
MxS32 wideViewAngle,
char* deviceId
);
MxResult SetupWindow();
bool LoadConfig();
void Tick();
void SetupCursor(Cursor p_cursor);
static MxU8 MapMouseButtonFlagsToModifier(SDL_MouseButtonFlags p_flags);
SDL_Window* GetWindowHandle() { return m_windowHandle; }
MxLong GetFrameDelta() { return m_frameDelta; }
MxS32 GetFullScreen() { return m_fullScreen; }
SDL_Cursor* GetCursorCurrent() { return m_cursorCurrent; }
SDL_Cursor* GetCursorBusy() { return m_cursorBusy; }
SDL_Cursor* GetCursorNo() { return m_cursorNo; }
MxS32 GetDrawCursor() { return m_drawCursor; }
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
MxResult ParseArguments(int argc, char** argv);
private:
char* m_hdPath; // 0x00
char* m_cdPath; // 0x04
char* m_deviceId; // 0x08
char* m_savePath; // 0x0c
MxS32 m_fullScreen; // 0x10
MxS32 m_flipSurfaces; // 0x14
MxS32 m_backBuffersInVram; // 0x18
MxS32 m_using8bit; // 0x1c
MxS32 m_using16bit; // 0x20
MxS32 m_unk0x24; // 0x24
MxS32 m_use3dSound; // 0x28
MxS32 m_useMusic; // 0x2c
MxS32 m_useJoystick; // 0x30
MxS32 m_joystickIndex; // 0x34
MxS32 m_wideViewAngle; // 0x38
MxS32 m_islandQuality; // 0x3c
MxS32 m_islandTexture; // 0x40
MxS32 m_gameStarted; // 0x44
MxLong m_frameDelta; // 0x48
MxVideoParam m_videoParam; // 0x4c
MxS32 m_windowActive; // 0x70
SDL_Window* m_windowHandle; // 0x74
MxS32 m_drawCursor; // 0x78
SDL_Cursor* m_cursorArrow; // 0x7c
SDL_Cursor* m_cursorBusy; // 0x80
SDL_Cursor* m_cursorNo; // 0x84
SDL_Cursor* m_cursorCurrent; // 0x88
char* m_mediaPath;
char* m_iniPath;
};
#endif // ISLEAPP_H