diff --git a/JGE/include/JSoundSystem.h b/JGE/include/JSoundSystem.h index d6d134203..3b233ba79 100644 --- a/JGE/include/JSoundSystem.h +++ b/JGE/include/JSoundSystem.h @@ -113,23 +113,29 @@ public: unsigned long fileSize(); #if (defined QT_CONFIG) && (!defined USE_PHONON) QMediaPlayer* effect; + void* mSample; +#elif defined (PSP) + WAVDATA* mSample; #elif defined (IOS) std::string filename; std::string key; std::string ext; + void* mSample; #elif defined (WITH_FMOD) FSOUND_SAMPLE *mSample; #elif defined (USE_PHONON) Phonon::AudioOutput* mOutput; Phonon::MediaObject* mMediaObject; + void* mSample; #elif defined ANDROID SLObjectItf playerObject; SLPlayItf playInterface; SLVolumeItf sampleVolumeInterface; + void* mSample; #elif (defined WIN32) std::string filename; -#endif void* mSample; +#endif }; diff --git a/JGE/src/Downloader.cpp b/JGE/src/Downloader.cpp index 997643b51..61cbdbafa 100644 --- a/JGE/src/Downloader.cpp +++ b/JGE/src/Downloader.cpp @@ -139,7 +139,7 @@ void DownloadRequest::fileDownloaded() // let's check some error if(mNetworkReply->error() != QNetworkReply::NoError) { - processError(NetworkReply->error(), mNetworkReply->errorString().toStdString()); + processError(mNetworkReply->error(), mNetworkReply->errorString().toStdString()); break; } diff --git a/JGE/src/JFileSystem.cpp b/JGE/src/JFileSystem.cpp index e85cab0b3..3f6fb149c 100644 --- a/JGE/src/JFileSystem.cpp +++ b/JGE/src/JFileSystem.cpp @@ -124,6 +124,10 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath) userPath = [[documentsDirectory stringByAppendingString: @"/User/"] cStringUsingEncoding:1]; systemPath = [[documentsDirectory stringByAppendingString: @"/Res/"] cStringUsingEncoding:1]; +#elif defined (__EMSCRIPTEN__) + systemPath = "/"; + DebugTrace("User path " << userPath); + DebugTrace("System path " << systemPath); #elif defined (ANDROID) userPath = JGE::GetInstance()->getFileSystemLocation(); systemPath = ""; @@ -296,6 +300,7 @@ void JFileSystem::DetachZipFile() bool JFileSystem::openForRead(izfstream & File, const string & FilePath) { + DebugTrace("JFileSystem::openForRead " << FilePath); File.open(FilePath.c_str(), mUserFS); if (File) return true; diff --git a/JGE/src/pc/JGfx.cpp b/JGE/src/pc/JGfx.cpp index 4c40b5a72..5b98591d3 100644 --- a/JGE/src/pc/JGfx.cpp +++ b/JGE/src/pc/JGfx.cpp @@ -2322,6 +2322,8 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture) // Pay attention when doing texture mapping!!! glBindTexture(GL_TEXTURE_2D, mCurrentTex); // Bind To The Texture ID + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); /* NOT USED if (mode == TEX_TYPE_MIPMAP) // generate mipmaps diff --git a/platforms/emscripten/configure.cmake b/platforms/emscripten/configure.cmake index 09b4ce8ed..39d711eb4 100644 --- a/platforms/emscripten/configure.cmake +++ b/platforms/emscripten/configure.cmake @@ -1,6 +1,8 @@ -set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -s FULL_ES2=1 -std=c++11 -g4 -s TOTAL_MEMORY=500000000 -s ALLOW_MEMORY_GROWTH=1") +set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -s FULL_ES2=1 -std=c++11 -O1 -s ALLOW_MEMORY_GROWTH=1 --preload-file ../../../projects/mtg/bin/Res@/") +#set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -s FULL_ES2=1 -std=c++11 -g4 -s ALLOW_MEMORY_GROWTH=1 --preload-file ../../../projects/mtg/bin/Res@/") set(CMAKE_EXECUTABLE_SUFFIX ".html") add_definitions(-DLINUX) add_definitions(-D_DEBUG) add_definitions(-DUSERDIR=".wagic") -add_definitions(-DRESDIR="Res") +add_definitions(-DRESDIR="/") +add_definitions(-DGL_ES_VERSION_2_0) \ No newline at end of file diff --git a/projects/mtg/src/SDLmain.cpp b/projects/mtg/src/SDLmain.cpp index 0ca9d7e60..df11cbdd2 100644 --- a/projects/mtg/src/SDLmain.cpp +++ b/projects/mtg/src/SDLmain.cpp @@ -128,7 +128,6 @@ public: static void OneIter() { - DebugTrace("OneIter"); SDL_Event Event; if (g_engine) { @@ -675,9 +674,9 @@ bool SdlApp::OnInit() window_h = ACTUAL_SCREEN_HEIGHT; #endif -#ifndef __EMSCRIPTEN__ - int buffers, samples; - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); + int buffers, samples; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); @@ -691,7 +690,7 @@ bool SdlApp::OnInit() SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &buffers); SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &samples); @@ -701,21 +700,21 @@ bool SdlApp::OnInit() SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); } - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); +#ifndef __EMSCRIPTEN__ + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); #else - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); - SDL_DisplayMode current; - SDL_GetCurrentDisplayMode(0, ¤t); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); + + SDL_DisplayMode current; + SDL_GetCurrentDisplayMode(0, ¤t); #endif #if (defined ANDROID) Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS; +#elif defined __EMSCRIPTEN__ + Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS; #else Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; #endif @@ -737,7 +736,7 @@ bool SdlApp::OnInit() glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background (yes that's the way fuckers) #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) -#if (defined GL_ES_VERSION_2_0) +#if (defined GL_ES_VERSION_2_0) && (!defined __EMSCRIPTEN__) glClearDepthf(1.0f); // Depth Buffer Setup #else glClearDepth(1.0f); // Depth Buffer Setup @@ -800,16 +799,16 @@ int main(int argc, char* argv[]) #endif DebugTrace("I R in da native"); - +/* DownloadRequest* downloadRequest = NULL; Downloader*downloader = Downloader::GetInstance(); downloadRequest = downloader->Get( "core.zip", - "file:///C:/Users/bieber/Documents/GitHub/wagic-cmake/build-emscripten/bin/Wagic-core.zip" + "file:///C:/Users/xawot_000/Documents/GitHub/wagic-master/build-emscripten/bin/Wagic-core.zip" // "http://127.0.0.1:8000/Wagic-core.zip" ); downloadRequest->waitUntilCompleted(); - +*/ g_launcher = new JGameLauncher(); u32 flags = g_launcher->GetInitFlags(); diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index 6f24c030b..b0281622f 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -206,7 +206,7 @@ ResourceManagerImpl::ResourceManagerImpl() LOG("Calling CacheEngine::Create"); -#ifdef PSP +#if (defined PSP) || (defined __EMSCRIPTEN__) CacheEngine::Create(textureWCache); #else CacheEngine::Create(textureWCache);