More random fixes

This commit is contained in:
pelya
2010-11-23 20:15:52 +02:00
parent 00a5ee79f8
commit 4bc5978d78
7 changed files with 49 additions and 15 deletions

View File

@@ -35,7 +35,14 @@ class AudioThread {
public int fillBuffer()
{
if( Globals.AudioBufferConfig == 0 && mAudio.getPlaybackHeadPosition() * 1000 / mAudio.getPlaybackRate() >= 30 )
{
try{
Thread.sleep(10);
} catch(InterruptedException e) {}
}
mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
return 1;
}

View File

@@ -17,7 +17,7 @@ AppUsesJoystick=n
AppHandlesJoystickSensitivity=n
AppUsesMultitouch=n
NonBlockingSwapBuffers=n
RedefinedKeys="LALT RETURN KP_PLUS KP_MINUS DELETE"
RedefinedKeys="LALT RETURN KP_PLUS KP_MINUS DELETE ESCAPE"
AppTouchscreenKeyboardKeysAmount=0
AppTouchscreenKeyboardKeysAmountAutoFire=0
MultiABI=n

View File

@@ -1,6 +1,6 @@
Index: src/sound/sdl_s.cpp
===================================================================
--- src/sound/sdl_s.cpp (revision 21200)
--- src/sound/sdl_s.cpp (revision 21293)
+++ src/sound/sdl_s.cpp (working copy)
@@ -20,9 +20,16 @@
@@ -13,7 +13,7 @@ Index: src/sound/sdl_s.cpp
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
{
MxMixSamples(stream, len / 4);
+#if defined(ANDROID) && defined(LIBTIMIDITY)
+#ifdef ANDROID
+ Android_MidiMixMusic((Sint16 *)stream, len / 2);
+#endif
}
@@ -21,9 +21,9 @@ Index: src/sound/sdl_s.cpp
const char *SoundDriver_SDL::Start(const char * const *parm)
Index: src/music/libtimidity.cpp
===================================================================
--- src/music/libtimidity.cpp (revision 21200)
--- src/music/libtimidity.cpp (revision 21293)
+++ src/music/libtimidity.cpp (working copy)
@@ -22,10 +22,13 @@
@@ -23,10 +23,13 @@
#include <sys/stat.h>
#include <errno.h>
#include <timidity.h>
@@ -37,7 +37,7 @@ Index: src/music/libtimidity.cpp
enum MidiState {
MIDI_STOPPED = 0,
MIDI_PLAYING = 1,
@@ -50,6 +53,24 @@
@@ -51,6 +54,24 @@
}
}
#endif /* PSP */
@@ -64,7 +64,7 @@ Index: src/music/libtimidity.cpp
Index: src/os/unix/unix.cpp
===================================================================
--- src/os/unix/unix.cpp (revision 21200)
--- src/os/unix/unix.cpp (revision 21293)
+++ src/os/unix/unix.cpp (working copy)
@@ -24,7 +24,7 @@
@@ -75,7 +75,7 @@ Index: src/os/unix/unix.cpp
#define HAS_STATVFS
#endif
@@ -245,6 +245,11 @@
@@ -239,6 +239,11 @@
void cocoaReleaseAutoreleasePool();
#endif
@@ -87,11 +87,27 @@ Index: src/os/unix/unix.cpp
int CDECL main(int argc, char *argv[])
{
int ret;
Index: src/os/unix/crashlog_unix.cpp
===================================================================
--- src/os/unix/crashlog_unix.cpp (revision 21293)
+++ src/os/unix/crashlog_unix.cpp (working copy)
@@ -141,7 +141,11 @@
};
/** The signals we want our crash handler to handle. */
+#ifdef ANDROID
+static const int _signals_to_handle[] = { }; // Default Android signal handler will give us stack trace
+#else
static const int _signals_to_handle[] = { SIGSEGV, SIGABRT, SIGFPE, SIGBUS, SIGILL };
+#endif
/**
* Entry point for the crash handler.
Index: src/network/core/os_abstraction.h
===================================================================
--- src/network/core/os_abstraction.h (revision 21200)
--- src/network/core/os_abstraction.h (revision 21293)
+++ src/network/core/os_abstraction.h (working copy)
@@ -161,7 +161,7 @@
@@ -159,7 +159,7 @@
# include <net/if.h>
/* According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. */
# if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \
@@ -102,7 +118,7 @@ Index: src/network/core/os_abstraction.h
* the list of IPs from the system. */
Index: src/debug.cpp
===================================================================
--- src/debug.cpp (revision 21200)
--- src/debug.cpp (revision 21293)
+++ src/debug.cpp (working copy)
@@ -16,6 +16,9 @@
#include "string_func.h"
@@ -114,8 +130,8 @@ Index: src/debug.cpp
#include <time.h>
@@ -76,6 +79,9 @@
*/
@@ -70,6 +73,9 @@
static void debug_print(const char *dbg, const char *buf)
{
+#ifdef ANDROID

View File

@@ -113,7 +113,7 @@ int SDL_ANDROID_sFakeWindowWidth = 640;
int SDL_ANDROID_sFakeWindowHeight = 480;
static int sdl_opengl = 0;
static SDL_Window *SDL_VideoWindow = NULL;
static SDL_Surface *SDL_CurrentVideoSurface = NULL;
SDL_Surface *SDL_CurrentVideoSurface = NULL;
static Uint32 SDL_VideoThreadID = 0;
static int HwSurfaceCount = 0;
static SDL_Surface ** HwSurfaceList = NULL;

View File

@@ -115,6 +115,8 @@ void UpdateScreenUnderFingerRect(int x, int y)
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, jint x, jint y, jint action, jint pointerId, jint force, jint radius )
{
if( !SDL_CurrentVideoSurface )
return;
if(pointerId < 0)
pointerId = 0;
if(pointerId > MAX_MULTITOUCH_POINTERS)
@@ -234,6 +236,8 @@ static int processAndroidTrackball(int key, int action);
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action )
{
if( !SDL_CurrentVideoSurface )
return;
if( isTrackballUsed )
if( processAndroidTrackball(key, action) )
return;
@@ -276,6 +280,8 @@ static void updateOrientation ( float accX, float accY, float accZ );
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(AccelerometerReader_nativeAccelerometer) ( JNIEnv* env, jobject thiz, jfloat accPosX, jfloat accPosY, jfloat accPosZ )
{
if( !SDL_CurrentVideoSurface )
return;
// Calculate two angles from three coordinates - TODO: this is faulty!
//float accX = atan2f(-accPosX, sqrtf(accPosY*accPosY+accPosZ*accPosZ) * ( accPosY > 0 ? 1.0f : -1.0f ) ) * M_1_PI * 180.0f;
//float accY = atan2f(accPosZ, accPosY) * M_1_PI;
@@ -292,6 +298,8 @@ JAVA_EXPORT_NAME(AccelerometerReader_nativeAccelerometer) ( JNIEnv* env, jobjec
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(AccelerometerReader_nativeOrientation) ( JNIEnv* env, jobject thiz, jfloat accX, jfloat accY, jfloat accZ )
{
if( !SDL_CurrentVideoSurface )
return;
updateOrientation (accX, accY, accZ); // TODO: make values in range 0.0:1.0
}

View File

@@ -33,6 +33,7 @@ extern int SDL_ANDROID_sRealWindowWidth;
extern int SDL_ANDROID_sRealWindowHeight;
extern int SDL_ANDROID_sFakeWindowWidth; // SDL 1.2 only
extern int SDL_ANDROID_sFakeWindowHeight; // SDL 1.2 only
extern SDL_Surface *SDL_CurrentVideoSurface;
extern SDL_Rect SDL_ANDROID_ForceClearScreenRect;
extern int SDL_ANDROID_ShowScreenUnderFinger;
extern SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect, SDL_ANDROID_ShowScreenUnderFingerRectSrc;

View File

@@ -2,6 +2,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <jni.h>
#include <android/log.h>
#include "SDL_thread.h"
@@ -30,7 +31,8 @@ extern C_LINKAGE void
JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring cmdline )
{
int i = 0;
char curdir[512], realcurdir[512];
char curdir[PATH_MAX] = "";
char realcurdir[PATH_MAX] = "";
const jbyte *jstr;
const char * str = "sdl";
int argc = 0;