Bladeren bron

Build on Windows

kiwec 1 maand geleden
bovenliggende
commit
b54cd0a3d8

+ 0 - 1
build.bat

@@ -21,7 +21,6 @@ rem set LDFLAGS=%LDFLAGS% -mwindows -s
 
 rem PREPARE BUILD DIR
 xcopy resources build /E /I /Y > nul
-if not exist build\cfg mkdir build\cfg
 
 for /d %%i in (libraries\*) do (
 	copy %%i\bin\* build\ > nul

BIN
libraries/bassfx/bin/libbass_fx.dylib


BIN
libraries/bassfx/lib/macos/libbass_fx.dylib


BIN
libraries/glew/bin/libGLEW.2.0.0.dylib


BIN
libraries/libjpeg/lib/macos/libjpeg.9.dylib


BIN
libraries/sdl/bin/SDL2.dylib


+ 0 - 0
resources/maps/maps.folder


+ 15 - 16
src/App/Osu/Downloader.cpp

@@ -3,7 +3,6 @@
 #include <curl/curl.h>
 #include <pthread.h>
 
-#include <mutex>
 #include <sstream>
 
 #include "Bancho.h"
@@ -27,15 +26,15 @@ struct DownloadThread {
     std::vector<DownloadResult*> downloads;
 };
 
-std::mutex threads_mtx;
+pthread_mutex_t threads_mtx = PTHREAD_MUTEX_INITIALIZER;
 std::vector<DownloadThread*> threads;
 
 void abort_downloads() {
-    threads_mtx.lock();
+    pthread_mutex_lock(&threads_mtx);
     for(auto thread : threads) {
         thread->running = false;
     }
-    threads_mtx.unlock();
+    pthread_mutex_unlock(&threads_mtx);
 }
 
 void update_download_progress(void* clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal,
@@ -43,14 +42,14 @@ void update_download_progress(void* clientp, curl_off_t dltotal, curl_off_t dlno
     (void)ultotal;
     (void)ulnow;
 
-    threads_mtx.lock();
+    pthread_mutex_lock(&threads_mtx);
     auto result = (DownloadResult*)clientp;
     if(dltotal == 0) {
         result->progress = 0.f;
     } else if(dlnow > 0) {
         result->progress = (float)dlnow / (float)dltotal;
     }
-    threads_mtx.unlock();
+    pthread_mutex_unlock(&threads_mtx);
 }
 
 void* do_downloads(void* arg) {
@@ -69,7 +68,7 @@ void* do_downloads(void* arg) {
         DownloadResult* result = nullptr;
         std::string url;
 
-        threads_mtx.lock();
+        pthread_mutex_lock(&threads_mtx);
         for(auto download : thread->downloads) {
             if(download->progress == 0.f) {
                 result = download;
@@ -77,7 +76,7 @@ void* do_downloads(void* arg) {
                 break;
             }
         }
-        threads_mtx.unlock();
+        pthread_mutex_unlock(&threads_mtx);
         if(!result) continue;
 
         free(response.memory);
@@ -100,15 +99,15 @@ void* do_downloads(void* arg) {
         int response_code;
         curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
         if(res == CURLE_OK) {
-            threads_mtx.lock();
+            pthread_mutex_lock(&threads_mtx);
             result->progress = 1.f;
             result->response_code = response_code;
             result->data = std::vector<uint8_t>(response.memory, response.memory + response.size);
-            threads_mtx.unlock();
+            pthread_mutex_unlock(&threads_mtx);
         } else {
             debugLog("Failed to download %s: %s\n", url.c_str(), curl_easy_strerror(res));
 
-            threads_mtx.lock();
+            pthread_mutex_lock(&threads_mtx);
             result->response_code = response_code;
             if(response_code == 429) {
                 result->progress = 0.f;
@@ -116,7 +115,7 @@ void* do_downloads(void* arg) {
                 result->data = std::vector<uint8_t>(response.memory, response.memory + response.size);
                 result->progress = -1.f;
             }
-            threads_mtx.unlock();
+            pthread_mutex_unlock(&threads_mtx);
 
             if(response_code == 429) {
                 // Try again 5s later
@@ -128,7 +127,7 @@ void* do_downloads(void* arg) {
 end_thread:
     curl_easy_cleanup(curl);
 
-    threads_mtx.lock();
+    pthread_mutex_lock(&threads_mtx);
     std::vector<DownloadThread*> new_threads;
     for(auto dt : threads) {
         if(thread != dt) {
@@ -136,7 +135,7 @@ end_thread:
         }
     }
     threads = std::move(new_threads);
-    threads_mtx.unlock();
+    pthread_mutex_unlock(&threads_mtx);
 
     free(response.memory);
     for(auto result : thread->downloads) {
@@ -167,7 +166,7 @@ void download(const char* url, float* progress, std::vector<uint8_t>& out, int*
         goto end;
     }
 
-    threads_mtx.lock();
+    pthread_mutex_lock(&threads_mtx);
     for(auto thread : threads) {
         if(thread->running && !strcmp(thread->endpoint.c_str(), hostname)) {
             matching_thread = thread;
@@ -211,7 +210,7 @@ void download(const char* url, float* progress, std::vector<uint8_t>& out, int*
         matching_thread->downloads.push_back(newdl);
         *progress = 0.f;
     }
-    threads_mtx.unlock();
+    pthread_mutex_unlock(&threads_mtx);
 
 end:
     curl_url_cleanup(urlu);

+ 1 - 1
src/App/Osu/OsuReplay.cpp

@@ -78,7 +78,7 @@ std::vector<OsuReplay::Frame> OsuReplay::get_frames(uint8_t* replay_data, int32_
 
     while(std::getline(ss, frame_str, ',')) {
         OsuReplay::Frame frame;
-        sscanf(frame_str.c_str(), "%ld|%f|%f|%hhu", &frame.milliseconds_since_last_frame, &frame.x, &frame.y,
+        sscanf(frame_str.c_str(), "%lld|%f|%f|%hhu", &frame.milliseconds_since_last_frame, &frame.x, &frame.y,
                &frame.key_flags);
 
         if(frame.milliseconds_since_last_frame != -12345) {

+ 1 - 1
src/App/Osu/OsuSongBrowser.cpp

@@ -4138,7 +4138,7 @@ void OsuSongBrowser::selectRandomBeatmap() {
 #ifdef _WIN32
     HCRYPTPROV hCryptProv;
     CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
-    CryptGenRandom(hCryptProv, sizeof(rng), &rng);
+    CryptGenRandom(hCryptProv, sizeof(rng), (BYTE*)&rng);
     CryptReleaseContext(hCryptProv, 0);
 #else
     getrandom(&rng, sizeof(rng), 0);