Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.50 KB | None | 0 0
  1. diff --git a/imagelib/loadjpeg.c b/imagelib/loadjpeg.c
  2. index 7127fc2..f21656e 100644
  3. --- a/imagelib/loadjpeg.c
  4. +++ b/imagelib/loadjpeg.c
  5. @@ -30,6 +30,9 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
  6. }
  7. }
  8. static void term_source (j_decompress_ptr cinfo) {}
  9. +
  10. +// The new version of libjpeg has its own jpeg_mem_src; commenting this one
  11. +#if 0
  12. static void jpeg_mem_src (j_decompress_ptr cinfo, void* buffer, long nbytes)
  13. {
  14. struct jpeg_source_mgr* src;
  15. @@ -49,6 +52,7 @@ static void jpeg_mem_src (j_decompress_ptr cinfo, void* buffer, long nbytes)
  16. src->bytes_in_buffer = nbytes;
  17. src->next_input_byte = (JOCTET*)buffer;
  18. }
  19. +#endif
  20.  
  21. image_t* imagelib_load_jpeg_from_mem(char* buf, size_t size, const imageloadersettings_t settings)
  22. {
  23. diff --git a/imagelib/loadpng.c b/imagelib/loadpng.c
  24. index 5b70599..378a4a6 100644
  25. --- a/imagelib/loadpng.c
  26. +++ b/imagelib/loadpng.c
  27. @@ -4,7 +4,7 @@
  28. #include "imagelib_priv.h"
  29.  
  30. #include <stdio.h>
  31. -#include <libpng12/png.h>
  32. +#include <libpng15/png.h>
  33. #include <stdlib.h>
  34.  
  35. typedef struct
  36. @@ -17,10 +17,10 @@ typedef struct
  37.  
  38. static void png_read_data(png_structp png_ptr, png_bytep outbuffer, png_size_t bytes_to_read)
  39. {
  40. - if(png_ptr->io_ptr==NULL)
  41. + if(png_get_io_ptr(png_ptr)==NULL)
  42. return;
  43.  
  44. - png_memory_buffer* readbuffer = (png_memory_buffer*)png_ptr->io_ptr;
  45. + png_memory_buffer* readbuffer = (png_memory_buffer*)png_get_io_ptr(png_ptr);
  46.  
  47. if (readbuffer->offset+bytes_to_read>readbuffer->size)
  48. return;
  49. diff --git a/makefile b/makefile
  50. index 7e3aaf8..94ad098 100644
  51. --- a/makefile
  52. +++ b/makefile
  53. @@ -18,6 +18,7 @@ SOURCES += $(wildcard accelerometer/*.c)
  54. SOURCES += $(wildcard audio/*.c)
  55. SOURCES += $(wildcard mixer/*.c)
  56.  
  57. +LDFLAGS += -lm -lrt
  58. # Platform-specific targets and configuration
  59. PLATFORM_INSTALL_TARGETS :=
  60. include platform/$(PLATFORM).mk
  61. diff --git a/modules/worldofgoo.c b/modules/worldofgoo.c
  62. index 9927859..e2e9c49 100644
  63. --- a/modules/worldofgoo.c
  64. +++ b/modules/worldofgoo.c
  65. @@ -34,8 +34,8 @@
  66. #include <unistd.h>
  67. #include <zlib.h>
  68.  
  69. -#include <SDL/SDL.h>
  70. -#include <SDL/SDL_mixer.h>
  71. +#include <SDL2/SDL.h>
  72. +#include <SDL2/SDL_mixer.h>
  73. #include <EGL/egl.h>
  74.  
  75. #include "common.h"
  76. @@ -190,7 +190,7 @@ load_sound(const char *filename)
  77. mem = (const char *)worldofgoo_priv.apk_in_mem + zip_index->offset;
  78. sound->rw = SDL_RWFromMem((void *)mem, zip_index->length);
  79. if (strstr(filename, "music/") != NULL) {
  80. - sound->music = Mix_LoadMUS_RW(sound->rw);
  81. + sound->music = Mix_LoadMUS_RW(sound->rw, 0);
  82. loaded = (sound->music != NULL);
  83. } else {
  84. sound->chunk = Mix_LoadWAV_RW(sound->rw, 0);
  85. diff --git a/platform/common/sdl_accelerometer_impl.h b/platform/common/sdl_accelerometer_impl.h
  86. index 8735c3c..bf38ce7 100644
  87. --- a/platform/common/sdl_accelerometer_impl.h
  88. +++ b/platform/common/sdl_accelerometer_impl.h
  89. @@ -27,7 +27,7 @@
  90. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  91. **/
  92.  
  93. -#include <SDL/SDL.h>
  94. +#include <SDL2/SDL.h>
  95.  
  96. #include "../../accelerometer/accelerometer.h"
  97.  
  98. diff --git a/platform/common/sdl_mixer_impl.h b/platform/common/sdl_mixer_impl.h
  99. index a80a08d..29ffc24 100644
  100. --- a/platform/common/sdl_mixer_impl.h
  101. +++ b/platform/common/sdl_mixer_impl.h
  102. @@ -29,8 +29,8 @@
  103.  
  104. #include "../../mixer/mixer.h"
  105.  
  106. -#include <SDL/SDL.h>
  107. -#include <SDL/SDL_mixer.h>
  108. +#include <SDL2/SDL.h>
  109. +#include <SDL2/SDL_mixer.h>
  110. #include <assert.h>
  111.  
  112. /* older SDL_mixer compatibility */
  113. @@ -91,7 +91,7 @@ sdl_mixer_load_music_buffer(struct Mixer *mixer, const char *buffer, size_t size
  114. {
  115. struct MixerMusic *music = calloc(1, sizeof(struct MixerMusic));
  116. SDL_RWops *rw = SDL_RWFromConstMem(buffer, size);
  117. - music->music = Mix_LoadMUS_RW(rw);
  118. + music->music = Mix_LoadMUS_RW(rw, 0);
  119. SDL_RWclose(rw);
  120. return music;
  121.  
  122. diff --git a/platform/harmattan.c b/platform/harmattan.c
  123. index 3c3f2ef..62b69ba 100644
  124. --- a/platform/harmattan.c
  125. +++ b/platform/harmattan.c
  126. @@ -30,21 +30,24 @@
  127.  
  128. #include "../apkenv.h"
  129.  
  130. -#include <SDL/SDL.h>
  131. +#include <SDL2/SDL.h>
  132.  
  133. -#include <SDL/SDL_syswm.h>
  134. -#include <X11/Xlib.h>
  135. -#include <X11/Xatom.h>
  136. +#include <SDL2/SDL_syswm.h>
  137. +//#include <X11/Xlib.h>
  138. +//#include <X11/Xatom.h>
  139.  
  140. #include "common/sdl_accelerometer_impl.h"
  141. #include "common/sdl_audio_impl.h"
  142. #include "common/sdl_mixer_impl.h"
  143. +#include "sdl12compat.h"
  144.  
  145. -struct PlatformPriv {
  146. - SDL_Surface *screen;
  147. -};
  148. +//struct PlatformPriv {
  149. +// SDL_Window *screen;
  150. +//};
  151. +
  152. +static SDL_Window * window = NULL;
  153.  
  154. -static struct PlatformPriv priv;
  155. +//static struct PlatformPriv priv;
  156.  
  157.  
  158. static int
  159. @@ -56,8 +59,13 @@ harmattan_init(int gles_version)
  160.  
  161. SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, gles_version);
  162. SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
  163. - priv.screen = SDL_SetVideoMode(0, 0, 0, SDL_OPENGLES | SDL_FULLSCREEN);
  164. + window = SDL_CreateWindow("SDL12Compat",
  165. + SDL_WINDOWPOS_UNDEFINED,
  166. + SDL_WINDOWPOS_UNDEFINED,
  167. + 0, 0,
  168. + SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
  169.  
  170. +#if 0
  171. if (priv.screen == NULL) {
  172. return 0;
  173. }
  174. @@ -79,7 +87,7 @@ harmattan_init(int gles_version)
  175. PropModeReplace, (unsigned char*)region, 4);
  176.  
  177. SDL_ShowCursor(0);
  178. -
  179. +#endif
  180. apkenv_accelerometer_register(sdl_accelerometer);
  181. apkenv_audio_register(sdl_audio);
  182. apkenv_mixer_register(sdl_mixer);
  183. @@ -87,30 +95,31 @@ harmattan_init(int gles_version)
  184. return 1;
  185. }
  186.  
  187. +
  188. static const char *
  189. harmattan_get_path(enum PlatformPath which)
  190. {
  191. switch (which) {
  192. case PLATFORM_PATH_INSTALL_DIRECTORY:
  193. - return "/home/user/.local/share/applications/";
  194. + return "/home/nemo/.local/share/applications/";
  195. case PLATFORM_PATH_DATA_DIRECTORY:
  196. - return "/home/user/.apkenv/";
  197. + return "/home/nemo/.apkenv/";
  198. case PLATFORM_PATH_MODULE_DIRECTORY:
  199. return "/opt/apkenv/modules/";
  200. default:
  201. return NULL;
  202. }
  203. }
  204. -
  205. +#if 0
  206. static void
  207. harmattan_get_size(int *width, int *height)
  208. {
  209. if (width) {
  210. - *width = priv.screen->w;
  211. + *width = screen->w;
  212. }
  213.  
  214. if (height) {
  215. - *height = priv.screen->h;
  216. + *height = screen->h;
  217. }
  218. }
  219.  
  220. @@ -151,6 +160,7 @@ harmattan_input_update(struct SupportModule *module)
  221.  
  222. return 0;
  223. }
  224. +#endif
  225.  
  226. static void
  227. harmattan_request_text_input(int is_password, const char *text,
  228. @@ -165,7 +175,7 @@ harmattan_request_text_input(int is_password, const char *text,
  229. static void
  230. harmattan_update()
  231. {
  232. - SDL_GL_SwapBuffers();
  233. + SDL_GL_SwapWindow(window);
  234. }
  235.  
  236. static void
  237. @@ -176,8 +186,8 @@ harmattan_exit()
  238. struct PlatformSupport platform_support = {
  239. harmattan_init,
  240. harmattan_get_path,
  241. - harmattan_get_size,
  242. - harmattan_input_update,
  243. + //harmattan_get_size,
  244. + //harmattan_input_update,
  245. harmattan_request_text_input,
  246. harmattan_update,
  247. harmattan_exit,
  248. diff --git a/platform/harmattan.mk b/platform/harmattan.mk
  249. index 81a0379..7898db4 100644
  250. --- a/platform/harmattan.mk
  251. +++ b/platform/harmattan.mk
  252. @@ -1,7 +1,7 @@
  253. SOURCES += platform/harmattan.c
  254. -LDFLAGS += -lSDL -lSDL_mixer
  255. +LDFLAGS += -lSDL2 -lSDL2_mixer
  256. CFLAGS += -DAPKENV_GLES -DAPKENV_GLES2
  257. -LDFLAGS += -lGLES_CM -lGLESv2 -lEGL
  258. +LDFLAGS += -lGLESv1_CM -lGLESv2 -lEGL
  259.  
  260. BIONIC_LIBS := $(wildcard libs/harmattan/*.so)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement