summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2016-11-15 17:39:14 -0500
committerFranklin Wei <frankhwei536@gmail.com>2016-11-15 17:39:14 -0500
commite9ffa0c7f730486edef98182045fc6d0610e15b3 (patch)
tree09ba92637eeaedd9d07209113112b675b4cb3587
parent3b81775fa03c037a4d0d29483fbe70c3e36e22e9 (diff)
downloadrockbox-e9ffa0c7f730486edef98182045fc6d0610e15b3.zip
rockbox-e9ffa0c7f730486edef98182045fc6d0610e15b3.tar.gz
rockbox-e9ffa0c7f730486edef98182045fc6d0610e15b3.tar.bz2
rockbox-e9ffa0c7f730486edef98182045fc6d0610e15b3.tar.xz
final fixes
Change-Id: Ia9143508c90f1c4be8018c801038ea751c1d4cb3
-rw-r--r--apps/plugins/xworld/engine.c4
-rw-r--r--apps/plugins/xworld/intern.c10
-rw-r--r--apps/plugins/xworld/intern.h13
-rw-r--r--apps/plugins/xworld/mixer.c5
-rw-r--r--apps/plugins/xworld/resource.c14
-rw-r--r--apps/plugins/xworld/sys.c3
6 files changed, 24 insertions, 25 deletions
diff --git a/apps/plugins/xworld/engine.c b/apps/plugins/xworld/engine.c
index 369d41d..a0c0eb1 100644
--- a/apps/plugins/xworld/engine.c
+++ b/apps/plugins/xworld/engine.c
@@ -262,11 +262,11 @@ void engine_init(struct Engine* e) {
player_init(&e->player);
/* Init virtual machine, legacy way */
- /* vm_initForPart(&e->vm, GAME_PART_FIRST); // This game part is the protection screen */
+ vm_initForPart(&e->vm, GAME_PART_FIRST); // This game part is the protection screen */
/* Try to cheat here. You can jump anywhere but the VM crashes afterward. */
/* Starting somewhere is probably not enough, the variables and calls return are probably missing. */
- vm_initForPart(&e->vm, GAME_PART2); /* Skip protection screen and go directly to intro */
+ /* vm_initForPart(&e->vm, GAME_PART2); /* Skip protection screen and go directly to intro */
/* vm_initForPart(&e->vm, GAME_PART3); CRASH */
/* vm_initForPart(&e->vm, GAME_PART4); Start directly in jail but then crash */
/* vm->initForPart(&e->vm, GAME_PART5); CRASH */
diff --git a/apps/plugins/xworld/intern.c b/apps/plugins/xworld/intern.c
index b003333..7a31c82 100644
--- a/apps/plugins/xworld/intern.c
+++ b/apps/plugins/xworld/intern.c
@@ -22,13 +22,3 @@
#include "intern.h"
#include "awendian.h"
-
-uint8_t scriptPtr_fetchByte(struct Ptr* p) {
- return *p->pc++;
-}
-
-uint16_t scriptPtr_fetchWord(struct Ptr* p) {
- uint16_t i = READ_BE_UINT16(p->pc);
- p->pc += 2;
- return i;
-}
diff --git a/apps/plugins/xworld/intern.h b/apps/plugins/xworld/intern.h
index c1550e6..90b6408 100644
--- a/apps/plugins/xworld/intern.h
+++ b/apps/plugins/xworld/intern.h
@@ -34,11 +34,18 @@ struct Ptr {
uint8_t* pc;
};
-uint8_t scriptPtr_fetchByte(struct Ptr* p);
-uint16_t scriptPtr_fetchWord(struct Ptr* p);
-
struct Point {
int16_t x, y;
};
+static inline uint8_t scriptPtr_fetchByte(struct Ptr* p) {
+ return *p->pc++;
+}
+
+static inline uint16_t scriptPtr_fetchWord(struct Ptr* p) {
+ uint16_t i = READ_BE_UINT16(p->pc);
+ p->pc += 2;
+ return i;
+}
+
#endif
diff --git a/apps/plugins/xworld/mixer.c b/apps/plugins/xworld/mixer.c
index 47916cd..6035045 100644
--- a/apps/plugins/xworld/mixer.c
+++ b/apps/plugins/xworld/mixer.c
@@ -124,7 +124,8 @@ void mixer_stopAll(struct Mixer* mx) {
static void mixer_mix(struct Mixer* mx, int8_t *buf, int len) {
int8_t *pBuf;
- sys_lockMutex(mx->sys, mx->_mutex);
+ /* disabled because this will be called in IRQ */
+ /*sys_lockMutex(mx->sys, mx->_mutex);*/
/* Clear the buffer since nothing guarantees we are receiving clean memory. */
rb->memset(buf, 0, len);
@@ -169,7 +170,7 @@ static void mixer_mix(struct Mixer* mx, int8_t *buf, int len) {
}
- sys_unlockMutex(mx->sys, mx->_mutex);
+ /*sys_unlockMutex(mx->sys, mx->_mutex);*/
}
static void mixer_mixCallback(void *param, uint8_t *buf, int len) {
diff --git a/apps/plugins/xworld/resource.c b/apps/plugins/xworld/resource.c
index 2820dcb..4bd93f0 100644
--- a/apps/plugins/xworld/resource.c
+++ b/apps/plugins/xworld/resource.c
@@ -354,12 +354,14 @@ void res_allocMemBlock(struct Resource* res) {
rb->audio_stop();
/* steal the audio buffer */
size_t sz;
- /* memory usage is as follows:
- [VM memory - 600K]
- [Framebuffers - 128K]
- [Temporary framebuffer - 192K]
- [String table buffer]
- */
+ /* memory usage is first statically allocated, then the remainder is used dynamically:
+ * static:
+ * [VM memory - 600K]
+ * [Framebuffers - 128K]
+ * [Temporary framebuffer - 192K]
+ * dynamic:
+ * [String table buffer]
+ */
res->_memPtrStart = rb->plugin_get_audio_buffer(&sz);
if(sz < MEM_BLOCK_SIZE + (4 * VID_PAGE_SIZE) + 320 * 200 * sizeof(fb_data))
{
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index db9cab6..9d52cf6 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -852,6 +852,7 @@ static void get_more(const void** start, size_t* size)
if(audio_sys->settings.sound_enabled && audio_callback)
{
audio_callback(audio_param, temp_soundbuf, audio_sys->settings.sound_bufsize);
+
/* convert xworld format (signed 8-bit) to rockbox format (stereo signed 16-bit) */
for(int i = 0; i < audio_sys->settings.sound_bufsize; ++i)
{
@@ -955,14 +956,12 @@ void sys_destroyMutex(struct System* sys, void *mutex)
void sys_lockMutex(struct System* sys, void *mutex)
{
(void) sys;
- debug(DBG_SYS, "calling mutex_lock in thread %d", rb->thread_self());
rb->mutex_lock((struct mutex*) mutex);
}
void sys_unlockMutex(struct System* sys, void *mutex)
{
(void) sys;
- debug(DBG_SYS, "calling mutex_unlock in thread %d", rb->thread_self());
rb->mutex_unlock((struct mutex*) mutex);
}