Fix indentation

This commit is contained in:
Nadia Holmquist Pedersen 2020-06-03 14:54:36 +02:00
parent 7829070b7f
commit 21f1856da2
2 changed files with 133 additions and 133 deletions

View File

@ -1,41 +1,41 @@
project(qt_sdl)
SET(SOURCES_QT_SDL
main.cpp
main_shaders.h
EmuSettingsDialog.cpp
InputConfigDialog.cpp
VideoSettingsDialog.cpp
AudioSettingsDialog.cpp
WifiSettingsDialog.cpp
Input.cpp
LAN_PCap.cpp
LAN_Socket.cpp
OSD.cpp
OSD_shaders.h
font.h
Platform.cpp
PlatformConfig.cpp
main.cpp
main_shaders.h
EmuSettingsDialog.cpp
InputConfigDialog.cpp
VideoSettingsDialog.cpp
AudioSettingsDialog.cpp
WifiSettingsDialog.cpp
Input.cpp
LAN_PCap.cpp
LAN_Socket.cpp
OSD.cpp
OSD_shaders.h
font.h
Platform.cpp
PlatformConfig.cpp
../Util_ROM.cpp
../Util_Video.cpp
../Util_Audio.cpp
../FrontendUtil.h
../mic_blow.h
../Util_ROM.cpp
../Util_Video.cpp
../Util_Audio.cpp
../FrontendUtil.h
../mic_blow.h
../../../melon.qrc
../../../melon.qrc
)
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()
if (BUILD_STATIC AND QT5_STATIC_DIR)
set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5)
set(Qt5_DIR ${QT5_STATIC_BASE})
set(Qt5Core_DIR ${QT5_STATIC_BASE}Core)
set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui)
set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets)
set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5)
set(Qt5_DIR ${QT5_STATIC_BASE})
set(Qt5Core_DIR ${QT5_STATIC_BASE}Core)
set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui)
set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets)
endif()
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
@ -49,9 +49,9 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL Release))
add_executable(melonDS WIN32 ${SOURCES_QT_SDL})
add_executable(melonDS WIN32 ${SOURCES_QT_SDL})
else()
add_executable(melonDS ${SOURCES_QT_SDL})
add_executable(melonDS ${SOURCES_QT_SDL})
endif()
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)
if (BUILD_STATIC)
target_link_libraries(melonDS -static ${SDL2_LIBRARIES})
target_link_libraries(melonDS -static ${SDL2_LIBRARIES})
else()
target_link_libraries(melonDS ${SDL2_LIBRARIES})
target_link_libraries(melonDS ${SDL2_LIBRARIES})
endif()
if (UNIX)
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)
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)
elseif (WIN32)
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")
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_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
if (BUILD_STATIC)
target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd)
else()
target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
if (BUILD_STATIC)
target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd)
else()
target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
endif()
if (PORTABLE)
add_definitions(-DPORTABLE)
add_definitions(-DPORTABLE)
endif()
install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)

View File

@ -32,7 +32,7 @@
#include <string>
#ifdef __WIN32__
#define NTDDI_VERSION 0x06000000 // GROSS FUCKING HACK
#define NTDDI_VERSION 0x06000000 // GROSS FUCKING HACK
#include <windows.h>
//#include <knownfolders.h> // FUCK THAT SHIT
#include <shlobj.h>
@ -104,11 +104,11 @@ void Init(int argc, char** argv)
}
#else
QString confdir;
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
config.mkdir("melonDS");
confdir = config.absolutePath() + "/melonDS/";
EmuDirectory = new char[confdir.length() + 1];
memcpy(EmuDirectory, confdir.toUtf8().data(), confdir.length());
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
config.mkdir("melonDS");
confdir = config.absolutePath() + "/melonDS/";
EmuDirectory = new char[confdir.length() + 1];
memcpy(EmuDirectory, confdir.toUtf8().data(), confdir.length());
#endif
}
@ -126,99 +126,99 @@ void StopEmu()
FILE* OpenFile(const char* path, const char* mode, bool mustexist)
{
QFile f(path);
QFile f(path);
if (mustexist && !f.exists())
{
return nullptr;
}
if (mustexist && !f.exists())
{
return nullptr;
}
QIODevice::OpenMode qmode;
if (strlen(mode) > 1 && mode[0] == 'r' && mode[1] == '+') {
qmode = QIODevice::OpenModeFlag::ReadWrite;
} else if (mode[0] == 'w') {
qmode = QIODevice::OpenModeFlag::Truncate;
} else {
qmode = QIODevice::OpenModeFlag::ReadOnly;
}
QIODevice::OpenMode qmode;
if (strlen(mode) > 1 && mode[0] == 'r' && mode[1] == '+') {
qmode = QIODevice::OpenModeFlag::ReadWrite;
} else if (mode[0] == 'w') {
qmode = QIODevice::OpenModeFlag::Truncate;
} else {
qmode = QIODevice::OpenModeFlag::ReadOnly;
}
f.open(qmode);
FILE* file = fdopen(dup(f.handle()), mode);
f.close();
f.open(qmode);
FILE* file = fdopen(dup(f.handle()), mode);
f.close();
return file;
return file;
}
FILE* OpenLocalFile(const char* path, const char* mode)
{
QString fullpath;
QString fullpath;
if (path[0] == '/')
{
// If it's an absolute path, just open that.
fullpath = path;
}
else
{
if (path[0] == '/')
{
// If it's an absolute path, just open that.
fullpath = path;
}
else
{
#ifdef PORTABLE
fullpath = QString("./") + path;
fullpath = QString("./") + path;
#else
// Check user configuration directory
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
config.mkdir("melonDS");
fullpath = config.absolutePath() + "/melonDS/";
fullpath.append(path);
// Check user configuration directory
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
config.mkdir("melonDS");
fullpath = config.absolutePath() + "/melonDS/";
fullpath.append(path);
#endif
}
}
return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
}
void* Thread_Create(void (* func)())
{
QThread* t = QThread::create(func);
t->start();
return (void*) t;
QThread* t = QThread::create(func);
t->start();
return (void*) t;
}
void Thread_Free(void* thread)
{
QThread* t = (QThread*) thread;
t->terminate();
delete t;
QThread* t = (QThread*) thread;
t->terminate();
delete t;
}
void Thread_Wait(void* thread)
{
((QThread*) thread)->wait();
((QThread*) thread)->wait();
}
void* Semaphore_Create()
{
return new QSemaphore();
return new QSemaphore();
}
void Semaphore_Free(void* sema)
{
delete (QSemaphore*) sema;
delete (QSemaphore*) 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)
{
((QSemaphore*) sema)->acquire();
((QSemaphore*) sema)->acquire();
}
void Semaphore_Post(void* sema)
{
((QSemaphore*) sema)->release();
((QSemaphore*) sema)->release();
}
@ -242,44 +242,44 @@ bool MP_Init()
#endif // __WIN32__
MPSocket = socket(AF_INET, SOCK_DGRAM, 0);
if (MPSocket < 0)
{
return false;
}
if (MPSocket < 0)
{
return false;
}
res = setsockopt(MPSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt_true, sizeof(int));
if (res < 0)
{
closesocket(MPSocket);
MPSocket = INVALID_SOCKET;
return false;
}
res = setsockopt(MPSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt_true, sizeof(int));
if (res < 0)
{
closesocket(MPSocket);
MPSocket = INVALID_SOCKET;
return false;
}
sockaddr_t saddr;
saddr.sa_family = AF_INET;
*(u32*)&saddr.sa_data[2] = htonl(Config::SocketBindAnyAddr ? INADDR_ANY : INADDR_LOOPBACK);
*(u16*)&saddr.sa_data[0] = htons(7064);
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
if (res < 0)
{
closesocket(MPSocket);
MPSocket = INVALID_SOCKET;
return false;
}
sockaddr_t saddr;
saddr.sa_family = AF_INET;
*(u32*)&saddr.sa_data[2] = htonl(Config::SocketBindAnyAddr ? INADDR_ANY : INADDR_LOOPBACK);
*(u16*)&saddr.sa_data[0] = htons(7064);
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
if (res < 0)
{
closesocket(MPSocket);
MPSocket = INVALID_SOCKET;
return false;
}
res = setsockopt(MPSocket, SOL_SOCKET, SO_BROADCAST, (const char*)&opt_true, sizeof(int));
if (res < 0)
{
closesocket(MPSocket);
MPSocket = INVALID_SOCKET;
return false;
}
res = setsockopt(MPSocket, SOL_SOCKET, SO_BROADCAST, (const char*)&opt_true, sizeof(int));
if (res < 0)
{
closesocket(MPSocket);
MPSocket = INVALID_SOCKET;
return false;
}
MPSendAddr.sa_family = AF_INET;
*(u32*)&MPSendAddr.sa_data[2] = htonl(INADDR_BROADCAST);
*(u16*)&MPSendAddr.sa_data[0] = htons(7064);
MPSendAddr.sa_family = AF_INET;
*(u32*)&MPSendAddr.sa_data[2] = htonl(INADDR_BROADCAST);
*(u16*)&MPSendAddr.sa_data[0] = htons(7064);
return true;
return true;
}
void MP_DeInit()
@ -320,14 +320,14 @@ int MP_RecvPacket(u8* data, bool block)
return 0;
fd_set fd;
struct timeval tv;
struct timeval tv;
FD_ZERO(&fd);
FD_SET(MPSocket, &fd);
tv.tv_sec = 0;
tv.tv_usec = block ? 5000 : 0;
FD_ZERO(&fd);
FD_SET(MPSocket, &fd);
tv.tv_sec = 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;
}