android_jni.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #include <jni.h>
  2. #include "palcommon.h"
  3. #include "global.h"
  4. #include "palcfg.h"
  5. char externalStoragePath[255];
  6. /*
  7. * Class: com_codeplex_sdlpal_PalActivity
  8. * Method: setExternalStorage
  9. * Signature: (Ljava/lang/String;)V
  10. */
  11. JNIEXPORT void JNICALL Java_com_codeplex_sdlpal_PalActivity_setExternalStorage(JNIEnv *env, jclass cls, jstring j_str)
  12. {
  13. const jchar* c_str= NULL;
  14. char* pBuff = externalStoragePath;
  15. c_str = (*env)->GetStringCritical(env,j_str,NULL);
  16. if (c_str == NULL)
  17. {
  18. return;
  19. }
  20. while(*c_str)
  21. {
  22. *pBuff++ = *c_str++;
  23. }
  24. (*env)->ReleaseStringCritical(env,j_str,c_str);
  25. strncat(externalStoragePath,"/sdlpal/",strnlen("/sdlpal/",255));
  26. return;
  27. }
  28. LPCSTR
  29. UTIL_BasePath(
  30. VOID
  31. )
  32. {
  33. return externalStoragePath;
  34. }
  35. LPCSTR
  36. UTIL_SavePath(
  37. VOID
  38. )
  39. {
  40. return externalStoragePath;
  41. }
  42. BOOL
  43. UTIL_GetScreenSize(
  44. DWORD *pdwScreenWidth,
  45. DWORD *pdwScreenHeight
  46. )
  47. {
  48. *pdwScreenWidth = 640;
  49. *pdwScreenHeight = 400;
  50. return TRUE;
  51. }
  52. BOOL
  53. UTIL_IsAbsolutePath(
  54. LPCSTR lpszFileName
  55. )
  56. {
  57. return FALSE;
  58. }
  59. INT
  60. UTIL_Platform_Init(
  61. int argc,
  62. char* argv[]
  63. )
  64. {
  65. gConfig.fLaunchSetting = FALSE;
  66. return 0;
  67. }
  68. VOID
  69. UTIL_Platform_Quit(
  70. VOID
  71. )
  72. {
  73. }