Update for latest mruby, emscripten
This commit is contained in:
		
							parent
							
								
									bd75100d24
								
							
						
					
					
						commit
						0dbe2008af
					
				
					 9 changed files with 2728 additions and 3153 deletions
				
			
		| 
						 | 
				
			
			@ -265,6 +265,11 @@ void __attribute__ ((optnone)) main_update_loop() {
 | 
			
		|||
#ifdef __EMSCRIPTEN__
 | 
			
		||||
	if (static_mrb->exc) {
 | 
			
		||||
		printf("Execution Errored\n");
 | 
			
		||||
		mrb_value s = mrb_funcall(static_mrb, mrb_obj_value(static_mrb->exc), "inspect", 0);
 | 
			
		||||
		if (mrb_string_p(s)) {
 | 
			
		||||
			printf("%s", mrb_str_to_cstr(static_mrb, s));
 | 
			
		||||
			printf("\n");
 | 
			
		||||
		}
 | 
			
		||||
		mrb_close(static_scriptmrb);
 | 
			
		||||
		shState->texPool().disable();
 | 
			
		||||
		mrb_close(static_mrb);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@
 | 
			
		|||
#include "binding-util.h"
 | 
			
		||||
#include "binding-types.h"
 | 
			
		||||
#include "serializable-binding.h"
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
#define ATTR_RW(Type, Attr, arg_type, mrb_val, arg_t_s) \
 | 
			
		||||
	MRB_METHOD(Type##Get##Attr) \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -38,4 +38,5 @@ bool SDL_rw_file_helper::write(char * data) {
 | 
			
		|||
        }
 | 
			
		||||
        SDL_RWclose(rw);
 | 
			
		||||
        }
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								binding-mruby/rpg.mrb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								binding-mruby/rpg.mrb
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -22,8 +22,8 @@
 | 
			
		|||
#ifndef BOOSTHASH_H
 | 
			
		||||
#define BOOSTHASH_H
 | 
			
		||||
 | 
			
		||||
#include <boost/unordered/unordered_map.hpp>
 | 
			
		||||
#include <boost/unordered/unordered_set.hpp>
 | 
			
		||||
#include <map>
 | 
			
		||||
#include <set>
 | 
			
		||||
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ template<typename K, typename V>
 | 
			
		|||
class BoostHash
 | 
			
		||||
{
 | 
			
		||||
private:
 | 
			
		||||
	typedef boost::unordered_map<K, V> BoostType;
 | 
			
		||||
	typedef std::map<K, V> BoostType;
 | 
			
		||||
	typedef std::pair<K, V> PairType;
 | 
			
		||||
	BoostType p;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -98,7 +98,7 @@ template<typename K>
 | 
			
		|||
class BoostSet
 | 
			
		||||
{
 | 
			
		||||
private:
 | 
			
		||||
	typedef boost::unordered_set<K> BoostType;
 | 
			
		||||
	typedef std::set<K> BoostType;
 | 
			
		||||
	BoostType p;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@
 | 
			
		|||
 | 
			
		||||
#include <al.h>
 | 
			
		||||
#include <alc.h>
 | 
			
		||||
#include <alext.h>
 | 
			
		||||
//#include <alext.h>
 | 
			
		||||
 | 
			
		||||
#include "sharedstate.h"
 | 
			
		||||
#include "graphics.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -41,18 +41,9 @@
 | 
			
		|||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
typedef void (ALC_APIENTRY *LPALCDEVICEPAUSESOFT) (ALCdevice *device);
 | 
			
		||||
typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device);
 | 
			
		||||
 | 
			
		||||
#define AL_DEVICE_PAUSE_FUN \
 | 
			
		||||
	AL_FUN(DevicePause, LPALCDEVICEPAUSESOFT) \
 | 
			
		||||
	AL_FUN(DeviceResume, LPALCDEVICERESUMESOFT)
 | 
			
		||||
 | 
			
		||||
struct ALCFunctions
 | 
			
		||||
{
 | 
			
		||||
#define AL_FUN(name, type) type name;
 | 
			
		||||
	AL_DEVICE_PAUSE_FUN
 | 
			
		||||
#undef AL_FUN
 | 
			
		||||
 | 
			
		||||
} static alc;
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			@ -62,13 +53,9 @@ initALCFunctions(ALCdevice *alcDev)
 | 
			
		|||
		return;
 | 
			
		||||
 | 
			
		||||
	Debug() << "ALC_SOFT_pause_device present";
 | 
			
		||||
 | 
			
		||||
#define AL_FUN(name, type) alc. name = (type) alcGetProcAddress(alcDev, "alc" #name "SOFT");
 | 
			
		||||
	AL_DEVICE_PAUSE_FUN;
 | 
			
		||||
#undef AL_FUN
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define HAVE_ALC_DEVICE_PAUSE alc.DevicePause
 | 
			
		||||
#define HAVE_ALC_DEVICE_PAUSE false
 | 
			
		||||
 | 
			
		||||
uint8_t EventThread::keyStates[];
 | 
			
		||||
EventThread::JoyState EventThread::joyState;
 | 
			
		||||
| 
						 | 
				
			
			@ -448,9 +435,6 @@ int EventThread::eventFilter(void *data, SDL_Event *event)
 | 
			
		|||
	case SDL_APP_WILLENTERBACKGROUND :
 | 
			
		||||
		Debug() << "SDL_APP_WILLENTERBACKGROUND";
 | 
			
		||||
 | 
			
		||||
		if (HAVE_ALC_DEVICE_PAUSE)
 | 
			
		||||
			alc.DevicePause(rtData.alcDev);
 | 
			
		||||
 | 
			
		||||
		rtData.syncPoint.haltThreads();
 | 
			
		||||
 | 
			
		||||
		return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -466,9 +450,6 @@ int EventThread::eventFilter(void *data, SDL_Event *event)
 | 
			
		|||
	case SDL_APP_DIDENTERFOREGROUND :
 | 
			
		||||
		Debug() << "SDL_APP_DIDENTERFOREGROUND";
 | 
			
		||||
 | 
			
		||||
		if (HAVE_ALC_DEVICE_PAUSE)
 | 
			
		||||
			alc.DeviceResume(rtData.alcDev);
 | 
			
		||||
 | 
			
		||||
		rtData.syncPoint.resumeThreads();
 | 
			
		||||
 | 
			
		||||
		return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,8 @@
 | 
			
		|||
#include "exception.h"
 | 
			
		||||
 | 
			
		||||
#include <SDL_video.h>
 | 
			
		||||
#include <GLES2/gl2.h>
 | 
			
		||||
#include <GLES2/gl2ext.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
GLFunctions gl;
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +71,7 @@ static void parseExtensionsCompat(_PFNGLGETSTRINGPROC GetString, BoostSet<std::s
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
#define GL_FUN(name, type) \
 | 
			
		||||
	gl.name = (type) SDL_GL_GetProcAddress("gl" #name EXT_SUFFIX);
 | 
			
		||||
	gl.name = (type) gl##name;
 | 
			
		||||
 | 
			
		||||
#define EXC(msg) \
 | 
			
		||||
	Exception(Exception::MKXPError, "%s", msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -108,15 +110,15 @@ void initGLFunctions()
 | 
			
		|||
 | 
			
		||||
	BoostSet<std::string> ext;
 | 
			
		||||
 | 
			
		||||
	if (glMajor >= 3)
 | 
			
		||||
		parseExtensionsCore(gl.GetIntegerv, ext);
 | 
			
		||||
	else
 | 
			
		||||
//	if (glMajor >= 3)
 | 
			
		||||
//		parseExtensionsCore(gl.GetIntegerv, ext);
 | 
			
		||||
	//else
 | 
			
		||||
		parseExtensionsCompat(gl.GetString, ext);
 | 
			
		||||
 | 
			
		||||
#define HAVE_EXT(_ext) ext.contains("GL_" #_ext)
 | 
			
		||||
 | 
			
		||||
	/* FBO entrypoints */
 | 
			
		||||
	if (glMajor >= 3 || HAVE_EXT(ARB_framebuffer_object))
 | 
			
		||||
	/*if (glMajor >= 3 || HAVE_EXT(ARB_framebuffer_object))
 | 
			
		||||
	{
 | 
			
		||||
#undef EXT_SUFFIX
 | 
			
		||||
#define EXT_SUFFIX ""
 | 
			
		||||
| 
						 | 
				
			
			@ -124,9 +126,9 @@ void initGLFunctions()
 | 
			
		|||
		GL_FBO_BLIT_FUN;
 | 
			
		||||
	}
 | 
			
		||||
	else if (gles && glMajor == 2)
 | 
			
		||||
	{
 | 
			
		||||
	{*/
 | 
			
		||||
		GL_FBO_FUN;
 | 
			
		||||
	}
 | 
			
		||||
	/*}
 | 
			
		||||
	else if (HAVE_EXT(EXT_framebuffer_object))
 | 
			
		||||
	{
 | 
			
		||||
#undef EXT_SUFFIX
 | 
			
		||||
| 
						 | 
				
			
			@ -141,10 +143,10 @@ void initGLFunctions()
 | 
			
		|||
	else
 | 
			
		||||
	{
 | 
			
		||||
		throw EXC("No FBO support available");
 | 
			
		||||
	}
 | 
			
		||||
	}*/
 | 
			
		||||
 | 
			
		||||
	/* VAO entrypoints */
 | 
			
		||||
	if (HAVE_EXT(ARB_vertex_array_object) || glMajor >= 3)
 | 
			
		||||
	/*if (HAVE_EXT(ARB_vertex_array_object) || glMajor >= 3)
 | 
			
		||||
	{
 | 
			
		||||
#undef EXT_SUFFIX
 | 
			
		||||
#define EXT_SUFFIX ""
 | 
			
		||||
| 
						 | 
				
			
			@ -161,10 +163,10 @@ void initGLFunctions()
 | 
			
		|||
#undef EXT_SUFFIX
 | 
			
		||||
#define EXT_SUFFIX "OES"
 | 
			
		||||
		GL_VAO_FUN;
 | 
			
		||||
	}
 | 
			
		||||
	}*/
 | 
			
		||||
 | 
			
		||||
	/* Debug callback entrypoints */
 | 
			
		||||
	if (HAVE_EXT(KHR_debug))
 | 
			
		||||
	/*if (HAVE_EXT(KHR_debug))
 | 
			
		||||
	{
 | 
			
		||||
#undef EXT_SUFFIX
 | 
			
		||||
#define EXT_SUFFIX ""
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +184,7 @@ void initGLFunctions()
 | 
			
		|||
#undef EXT_SUFFIX
 | 
			
		||||
#define EXT_SUFFIX "GREMEDY"
 | 
			
		||||
		GL_GREMEMDY_FUN;
 | 
			
		||||
	}
 | 
			
		||||
	}*/
 | 
			
		||||
 | 
			
		||||
	/* Misc caps */
 | 
			
		||||
	if (!gles || glMajor >= 3 || HAVE_EXT(EXT_unpack_subimage))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
#include "boost-hash.h"
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
struct RGSS_entryData
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -281,8 +281,9 @@ static const PHYSFS_Io RGSS_IoTemplate =
 | 
			
		|||
 | 
			
		||||
static void
 | 
			
		||||
processDirectories(RGSS_archiveData *data, BoostSet<std::string> &topLevel,
 | 
			
		||||
                   char *nameBuf, uint32_t nameLen)
 | 
			
		||||
                   char *nameBufc, uint32_t nameLen)
 | 
			
		||||
{
 | 
			
		||||
	std::string nameBuf(nameBufc);
 | 
			
		||||
	/* Check for top level entries */
 | 
			
		||||
	for (uint32_t i = 0; i < nameLen; ++i)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -307,7 +308,7 @@ processDirectories(RGSS_archiveData *data, BoostSet<std::string> &topLevel,
 | 
			
		|||
		{
 | 
			
		||||
			nameBuf[i] = '\0';
 | 
			
		||||
 | 
			
		||||
			const char *dir = nameBuf;
 | 
			
		||||
			const char *dir = nameBuf.c_str();
 | 
			
		||||
			const char *entry = &nameBuf[i+1];
 | 
			
		||||
 | 
			
		||||
			BoostSet<std::string> &entryList = data->dirHash[dir];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue