mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
Fix indentation
This commit is contained in:
@ -1,41 +1,41 @@
|
|||||||
project(qt_sdl)
|
project(qt_sdl)
|
||||||
|
|
||||||
SET(SOURCES_QT_SDL
|
SET(SOURCES_QT_SDL
|
||||||
main.cpp
|
main.cpp
|
||||||
main_shaders.h
|
main_shaders.h
|
||||||
EmuSettingsDialog.cpp
|
EmuSettingsDialog.cpp
|
||||||
InputConfigDialog.cpp
|
InputConfigDialog.cpp
|
||||||
VideoSettingsDialog.cpp
|
VideoSettingsDialog.cpp
|
||||||
AudioSettingsDialog.cpp
|
AudioSettingsDialog.cpp
|
||||||
WifiSettingsDialog.cpp
|
WifiSettingsDialog.cpp
|
||||||
Input.cpp
|
Input.cpp
|
||||||
LAN_PCap.cpp
|
LAN_PCap.cpp
|
||||||
LAN_Socket.cpp
|
LAN_Socket.cpp
|
||||||
OSD.cpp
|
OSD.cpp
|
||||||
OSD_shaders.h
|
OSD_shaders.h
|
||||||
font.h
|
font.h
|
||||||
Platform.cpp
|
Platform.cpp
|
||||||
PlatformConfig.cpp
|
PlatformConfig.cpp
|
||||||
|
|
||||||
../Util_ROM.cpp
|
../Util_ROM.cpp
|
||||||
../Util_Video.cpp
|
../Util_Video.cpp
|
||||||
../Util_Audio.cpp
|
../Util_Audio.cpp
|
||||||
../FrontendUtil.h
|
../FrontendUtil.h
|
||||||
../mic_blow.h
|
../mic_blow.h
|
||||||
|
|
||||||
../../../melon.qrc
|
../../../melon.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> -o <OBJECT>")
|
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> -o <OBJECT>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_STATIC AND QT5_STATIC_DIR)
|
if (BUILD_STATIC AND QT5_STATIC_DIR)
|
||||||
set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5)
|
set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5)
|
||||||
set(Qt5_DIR ${QT5_STATIC_BASE})
|
set(Qt5_DIR ${QT5_STATIC_BASE})
|
||||||
set(Qt5Core_DIR ${QT5_STATIC_BASE}Core)
|
set(Qt5Core_DIR ${QT5_STATIC_BASE}Core)
|
||||||
set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui)
|
set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui)
|
||||||
set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets)
|
set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
|
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||||
@ -49,9 +49,9 @@ find_package(PkgConfig REQUIRED)
|
|||||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||||
|
|
||||||
if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL Release))
|
if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL Release))
|
||||||
add_executable(melonDS WIN32 ${SOURCES_QT_SDL})
|
add_executable(melonDS WIN32 ${SOURCES_QT_SDL})
|
||||||
else()
|
else()
|
||||||
add_executable(melonDS ${SOURCES_QT_SDL})
|
add_executable(melonDS ${SOURCES_QT_SDL})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT})
|
||||||
@ -63,28 +63,28 @@ target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
|||||||
target_link_libraries(melonDS core)
|
target_link_libraries(melonDS core)
|
||||||
|
|
||||||
if (BUILD_STATIC)
|
if (BUILD_STATIC)
|
||||||
target_link_libraries(melonDS -static ${SDL2_LIBRARIES})
|
target_link_libraries(melonDS -static ${SDL2_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
target_link_libraries(melonDS ${SDL2_LIBRARIES})
|
target_link_libraries(melonDS ${SDL2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
|
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
|
||||||
target_link_libraries(melonDS dl Qt5::Core Qt5::Gui Qt5::Widgets)
|
target_link_libraries(melonDS dl Qt5::Core Qt5::Gui Qt5::Widgets)
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON)
|
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON)
|
||||||
target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")
|
target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")
|
||||||
|
|
||||||
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
|
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
|
||||||
if (BUILD_STATIC)
|
if (BUILD_STATIC)
|
||||||
target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd)
|
target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets)
|
target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PORTABLE)
|
if (PORTABLE)
|
||||||
add_definitions(-DPORTABLE)
|
add_definitions(-DPORTABLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
#define NTDDI_VERSION 0x06000000 // GROSS FUCKING HACK
|
#define NTDDI_VERSION 0x06000000 // GROSS FUCKING HACK
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
//#include <knownfolders.h> // FUCK THAT SHIT
|
//#include <knownfolders.h> // FUCK THAT SHIT
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
@ -104,11 +104,11 @@ void Init(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
QString confdir;
|
QString confdir;
|
||||||
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
|
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
|
||||||
config.mkdir("melonDS");
|
config.mkdir("melonDS");
|
||||||
confdir = config.absolutePath() + "/melonDS/";
|
confdir = config.absolutePath() + "/melonDS/";
|
||||||
EmuDirectory = new char[confdir.length() + 1];
|
EmuDirectory = new char[confdir.length() + 1];
|
||||||
memcpy(EmuDirectory, confdir.toUtf8().data(), confdir.length());
|
memcpy(EmuDirectory, confdir.toUtf8().data(), confdir.length());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,99 +126,99 @@ void StopEmu()
|
|||||||
|
|
||||||
FILE* OpenFile(const char* path, const char* mode, bool mustexist)
|
FILE* OpenFile(const char* path, const char* mode, bool mustexist)
|
||||||
{
|
{
|
||||||
QFile f(path);
|
QFile f(path);
|
||||||
|
|
||||||
if (mustexist && !f.exists())
|
if (mustexist && !f.exists())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIODevice::OpenMode qmode;
|
QIODevice::OpenMode qmode;
|
||||||
if (strlen(mode) > 1 && mode[0] == 'r' && mode[1] == '+') {
|
if (strlen(mode) > 1 && mode[0] == 'r' && mode[1] == '+') {
|
||||||
qmode = QIODevice::OpenModeFlag::ReadWrite;
|
qmode = QIODevice::OpenModeFlag::ReadWrite;
|
||||||
} else if (mode[0] == 'w') {
|
} else if (mode[0] == 'w') {
|
||||||
qmode = QIODevice::OpenModeFlag::Truncate;
|
qmode = QIODevice::OpenModeFlag::Truncate;
|
||||||
} else {
|
} else {
|
||||||
qmode = QIODevice::OpenModeFlag::ReadOnly;
|
qmode = QIODevice::OpenModeFlag::ReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
f.open(qmode);
|
f.open(qmode);
|
||||||
FILE* file = fdopen(dup(f.handle()), mode);
|
FILE* file = fdopen(dup(f.handle()), mode);
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* OpenLocalFile(const char* path, const char* mode)
|
FILE* OpenLocalFile(const char* path, const char* mode)
|
||||||
{
|
{
|
||||||
QString fullpath;
|
QString fullpath;
|
||||||
|
|
||||||
if (path[0] == '/')
|
if (path[0] == '/')
|
||||||
{
|
{
|
||||||
// If it's an absolute path, just open that.
|
// If it's an absolute path, just open that.
|
||||||
fullpath = path;
|
fullpath = path;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef PORTABLE
|
#ifdef PORTABLE
|
||||||
fullpath = QString("./") + path;
|
fullpath = QString("./") + path;
|
||||||
#else
|
#else
|
||||||
// Check user configuration directory
|
// Check user configuration directory
|
||||||
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
|
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
|
||||||
config.mkdir("melonDS");
|
config.mkdir("melonDS");
|
||||||
fullpath = config.absolutePath() + "/melonDS/";
|
fullpath = config.absolutePath() + "/melonDS/";
|
||||||
fullpath.append(path);
|
fullpath.append(path);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
|
return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Thread_Create(void (* func)())
|
void* Thread_Create(void (* func)())
|
||||||
{
|
{
|
||||||
QThread* t = QThread::create(func);
|
QThread* t = QThread::create(func);
|
||||||
t->start();
|
t->start();
|
||||||
return (void*) t;
|
return (void*) t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread_Free(void* thread)
|
void Thread_Free(void* thread)
|
||||||
{
|
{
|
||||||
QThread* t = (QThread*) thread;
|
QThread* t = (QThread*) thread;
|
||||||
t->terminate();
|
t->terminate();
|
||||||
delete t;
|
delete t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread_Wait(void* thread)
|
void Thread_Wait(void* thread)
|
||||||
{
|
{
|
||||||
((QThread*) thread)->wait();
|
((QThread*) thread)->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* Semaphore_Create()
|
void* Semaphore_Create()
|
||||||
{
|
{
|
||||||
return new QSemaphore();
|
return new QSemaphore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore_Free(void* sema)
|
void Semaphore_Free(void* sema)
|
||||||
{
|
{
|
||||||
delete (QSemaphore*) sema;
|
delete (QSemaphore*) sema;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore_Reset(void* sema)
|
void Semaphore_Reset(void* sema)
|
||||||
{
|
{
|
||||||
QSemaphore* s = (QSemaphore*) sema;
|
QSemaphore* s = (QSemaphore*) sema;
|
||||||
|
|
||||||
s->acquire(s->available());
|
s->acquire(s->available());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore_Wait(void* sema)
|
void Semaphore_Wait(void* sema)
|
||||||
{
|
{
|
||||||
((QSemaphore*) sema)->acquire();
|
((QSemaphore*) sema)->acquire();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Semaphore_Post(void* sema)
|
void Semaphore_Post(void* sema)
|
||||||
{
|
{
|
||||||
((QSemaphore*) sema)->release();
|
((QSemaphore*) sema)->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -242,44 +242,44 @@ bool MP_Init()
|
|||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
|
|
||||||
MPSocket = socket(AF_INET, SOCK_DGRAM, 0);
|
MPSocket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
if (MPSocket < 0)
|
if (MPSocket < 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = setsockopt(MPSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt_true, sizeof(int));
|
res = setsockopt(MPSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt_true, sizeof(int));
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
{
|
{
|
||||||
closesocket(MPSocket);
|
closesocket(MPSocket);
|
||||||
MPSocket = INVALID_SOCKET;
|
MPSocket = INVALID_SOCKET;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sockaddr_t saddr;
|
sockaddr_t saddr;
|
||||||
saddr.sa_family = AF_INET;
|
saddr.sa_family = AF_INET;
|
||||||
*(u32*)&saddr.sa_data[2] = htonl(Config::SocketBindAnyAddr ? INADDR_ANY : INADDR_LOOPBACK);
|
*(u32*)&saddr.sa_data[2] = htonl(Config::SocketBindAnyAddr ? INADDR_ANY : INADDR_LOOPBACK);
|
||||||
*(u16*)&saddr.sa_data[0] = htons(7064);
|
*(u16*)&saddr.sa_data[0] = htons(7064);
|
||||||
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
|
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
{
|
{
|
||||||
closesocket(MPSocket);
|
closesocket(MPSocket);
|
||||||
MPSocket = INVALID_SOCKET;
|
MPSocket = INVALID_SOCKET;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = setsockopt(MPSocket, SOL_SOCKET, SO_BROADCAST, (const char*)&opt_true, sizeof(int));
|
res = setsockopt(MPSocket, SOL_SOCKET, SO_BROADCAST, (const char*)&opt_true, sizeof(int));
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
{
|
{
|
||||||
closesocket(MPSocket);
|
closesocket(MPSocket);
|
||||||
MPSocket = INVALID_SOCKET;
|
MPSocket = INVALID_SOCKET;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPSendAddr.sa_family = AF_INET;
|
MPSendAddr.sa_family = AF_INET;
|
||||||
*(u32*)&MPSendAddr.sa_data[2] = htonl(INADDR_BROADCAST);
|
*(u32*)&MPSendAddr.sa_data[2] = htonl(INADDR_BROADCAST);
|
||||||
*(u16*)&MPSendAddr.sa_data[0] = htons(7064);
|
*(u16*)&MPSendAddr.sa_data[0] = htons(7064);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MP_DeInit()
|
void MP_DeInit()
|
||||||
@ -320,14 +320,14 @@ int MP_RecvPacket(u8* data, bool block)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fd_set fd;
|
fd_set fd;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
FD_ZERO(&fd);
|
FD_ZERO(&fd);
|
||||||
FD_SET(MPSocket, &fd);
|
FD_SET(MPSocket, &fd);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = block ? 5000 : 0;
|
tv.tv_usec = block ? 5000 : 0;
|
||||||
|
|
||||||
if (!select(MPSocket+1, &fd, 0, 0, &tv))
|
if (!select(MPSocket+1, &fd, 0, 0, &tv))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user