Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/imagelib/loadjpeg.c b/imagelib/loadjpeg.c
- index 7127fc2..f21656e 100644
- --- a/imagelib/loadjpeg.c
- +++ b/imagelib/loadjpeg.c
- @@ -30,6 +30,9 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
- }
- }
- static void term_source (j_decompress_ptr cinfo) {}
- +
- +// The new version of libjpeg has its own jpeg_mem_src; commenting this one
- +#if 0
- static void jpeg_mem_src (j_decompress_ptr cinfo, void* buffer, long nbytes)
- {
- struct jpeg_source_mgr* src;
- @@ -49,6 +52,7 @@ static void jpeg_mem_src (j_decompress_ptr cinfo, void* buffer, long nbytes)
- src->bytes_in_buffer = nbytes;
- src->next_input_byte = (JOCTET*)buffer;
- }
- +#endif
- image_t* imagelib_load_jpeg_from_mem(char* buf, size_t size, const imageloadersettings_t settings)
- {
- diff --git a/imagelib/loadpng.c b/imagelib/loadpng.c
- index 5b70599..378a4a6 100644
- --- a/imagelib/loadpng.c
- +++ b/imagelib/loadpng.c
- @@ -4,7 +4,7 @@
- #include "imagelib_priv.h"
- #include <stdio.h>
- -#include <libpng12/png.h>
- +#include <libpng15/png.h>
- #include <stdlib.h>
- typedef struct
- @@ -17,10 +17,10 @@ typedef struct
- static void png_read_data(png_structp png_ptr, png_bytep outbuffer, png_size_t bytes_to_read)
- {
- - if(png_ptr->io_ptr==NULL)
- + if(png_get_io_ptr(png_ptr)==NULL)
- return;
- - png_memory_buffer* readbuffer = (png_memory_buffer*)png_ptr->io_ptr;
- + png_memory_buffer* readbuffer = (png_memory_buffer*)png_get_io_ptr(png_ptr);
- if (readbuffer->offset+bytes_to_read>readbuffer->size)
- return;
- diff --git a/makefile b/makefile
- index 7e3aaf8..94ad098 100644
- --- a/makefile
- +++ b/makefile
- @@ -18,6 +18,7 @@ SOURCES += $(wildcard accelerometer/*.c)
- SOURCES += $(wildcard audio/*.c)
- SOURCES += $(wildcard mixer/*.c)
- +LDFLAGS += -lm -lrt
- # Platform-specific targets and configuration
- PLATFORM_INSTALL_TARGETS :=
- include platform/$(PLATFORM).mk
- diff --git a/modules/worldofgoo.c b/modules/worldofgoo.c
- index 9927859..e2e9c49 100644
- --- a/modules/worldofgoo.c
- +++ b/modules/worldofgoo.c
- @@ -34,8 +34,8 @@
- #include <unistd.h>
- #include <zlib.h>
- -#include <SDL/SDL.h>
- -#include <SDL/SDL_mixer.h>
- +#include <SDL2/SDL.h>
- +#include <SDL2/SDL_mixer.h>
- #include <EGL/egl.h>
- #include "common.h"
- @@ -190,7 +190,7 @@ load_sound(const char *filename)
- mem = (const char *)worldofgoo_priv.apk_in_mem + zip_index->offset;
- sound->rw = SDL_RWFromMem((void *)mem, zip_index->length);
- if (strstr(filename, "music/") != NULL) {
- - sound->music = Mix_LoadMUS_RW(sound->rw);
- + sound->music = Mix_LoadMUS_RW(sound->rw, 0);
- loaded = (sound->music != NULL);
- } else {
- sound->chunk = Mix_LoadWAV_RW(sound->rw, 0);
- diff --git a/platform/common/sdl_accelerometer_impl.h b/platform/common/sdl_accelerometer_impl.h
- index 8735c3c..bf38ce7 100644
- --- a/platform/common/sdl_accelerometer_impl.h
- +++ b/platform/common/sdl_accelerometer_impl.h
- @@ -27,7 +27,7 @@
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- **/
- -#include <SDL/SDL.h>
- +#include <SDL2/SDL.h>
- #include "../../accelerometer/accelerometer.h"
- diff --git a/platform/common/sdl_mixer_impl.h b/platform/common/sdl_mixer_impl.h
- index a80a08d..29ffc24 100644
- --- a/platform/common/sdl_mixer_impl.h
- +++ b/platform/common/sdl_mixer_impl.h
- @@ -29,8 +29,8 @@
- #include "../../mixer/mixer.h"
- -#include <SDL/SDL.h>
- -#include <SDL/SDL_mixer.h>
- +#include <SDL2/SDL.h>
- +#include <SDL2/SDL_mixer.h>
- #include <assert.h>
- /* older SDL_mixer compatibility */
- @@ -91,7 +91,7 @@ sdl_mixer_load_music_buffer(struct Mixer *mixer, const char *buffer, size_t size
- {
- struct MixerMusic *music = calloc(1, sizeof(struct MixerMusic));
- SDL_RWops *rw = SDL_RWFromConstMem(buffer, size);
- - music->music = Mix_LoadMUS_RW(rw);
- + music->music = Mix_LoadMUS_RW(rw, 0);
- SDL_RWclose(rw);
- return music;
- diff --git a/platform/harmattan.c b/platform/harmattan.c
- index 3c3f2ef..62b69ba 100644
- --- a/platform/harmattan.c
- +++ b/platform/harmattan.c
- @@ -30,21 +30,24 @@
- #include "../apkenv.h"
- -#include <SDL/SDL.h>
- +#include <SDL2/SDL.h>
- -#include <SDL/SDL_syswm.h>
- -#include <X11/Xlib.h>
- -#include <X11/Xatom.h>
- +#include <SDL2/SDL_syswm.h>
- +//#include <X11/Xlib.h>
- +//#include <X11/Xatom.h>
- #include "common/sdl_accelerometer_impl.h"
- #include "common/sdl_audio_impl.h"
- #include "common/sdl_mixer_impl.h"
- +#include "sdl12compat.h"
- -struct PlatformPriv {
- - SDL_Surface *screen;
- -};
- +//struct PlatformPriv {
- +// SDL_Window *screen;
- +//};
- +
- +static SDL_Window * window = NULL;
- -static struct PlatformPriv priv;
- +//static struct PlatformPriv priv;
- static int
- @@ -56,8 +59,13 @@ harmattan_init(int gles_version)
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, gles_version);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- - priv.screen = SDL_SetVideoMode(0, 0, 0, SDL_OPENGLES | SDL_FULLSCREEN);
- + window = SDL_CreateWindow("SDL12Compat",
- + SDL_WINDOWPOS_UNDEFINED,
- + SDL_WINDOWPOS_UNDEFINED,
- + 0, 0,
- + SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
- +#if 0
- if (priv.screen == NULL) {
- return 0;
- }
- @@ -79,7 +87,7 @@ harmattan_init(int gles_version)
- PropModeReplace, (unsigned char*)region, 4);
- SDL_ShowCursor(0);
- -
- +#endif
- apkenv_accelerometer_register(sdl_accelerometer);
- apkenv_audio_register(sdl_audio);
- apkenv_mixer_register(sdl_mixer);
- @@ -87,30 +95,31 @@ harmattan_init(int gles_version)
- return 1;
- }
- +
- static const char *
- harmattan_get_path(enum PlatformPath which)
- {
- switch (which) {
- case PLATFORM_PATH_INSTALL_DIRECTORY:
- - return "/home/user/.local/share/applications/";
- + return "/home/nemo/.local/share/applications/";
- case PLATFORM_PATH_DATA_DIRECTORY:
- - return "/home/user/.apkenv/";
- + return "/home/nemo/.apkenv/";
- case PLATFORM_PATH_MODULE_DIRECTORY:
- return "/opt/apkenv/modules/";
- default:
- return NULL;
- }
- }
- -
- +#if 0
- static void
- harmattan_get_size(int *width, int *height)
- {
- if (width) {
- - *width = priv.screen->w;
- + *width = screen->w;
- }
- if (height) {
- - *height = priv.screen->h;
- + *height = screen->h;
- }
- }
- @@ -151,6 +160,7 @@ harmattan_input_update(struct SupportModule *module)
- return 0;
- }
- +#endif
- static void
- harmattan_request_text_input(int is_password, const char *text,
- @@ -165,7 +175,7 @@ harmattan_request_text_input(int is_password, const char *text,
- static void
- harmattan_update()
- {
- - SDL_GL_SwapBuffers();
- + SDL_GL_SwapWindow(window);
- }
- static void
- @@ -176,8 +186,8 @@ harmattan_exit()
- struct PlatformSupport platform_support = {
- harmattan_init,
- harmattan_get_path,
- - harmattan_get_size,
- - harmattan_input_update,
- + //harmattan_get_size,
- + //harmattan_input_update,
- harmattan_request_text_input,
- harmattan_update,
- harmattan_exit,
- diff --git a/platform/harmattan.mk b/platform/harmattan.mk
- index 81a0379..7898db4 100644
- --- a/platform/harmattan.mk
- +++ b/platform/harmattan.mk
- @@ -1,7 +1,7 @@
- SOURCES += platform/harmattan.c
- -LDFLAGS += -lSDL -lSDL_mixer
- +LDFLAGS += -lSDL2 -lSDL2_mixer
- CFLAGS += -DAPKENV_GLES -DAPKENV_GLES2
- -LDFLAGS += -lGLES_CM -lGLESv2 -lEGL
- +LDFLAGS += -lGLESv1_CM -lGLESv2 -lEGL
- BIONIC_LIBS := $(wildcard libs/harmattan/*.so)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement