foxygit / doom Log in
commit e4d9b85aa45fe31cb9b18a1ac8e9a95c7bc6ea5b
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Tue Oct 7 22:47:29 2014 -0400
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Tue Oct 7 22:47:29 2014 -0400

    opl: Use uint64_t for microsecond times.

    Previous revamping of the OPL library changed delay times from ms
    to us, and switched to 64-bit times for storage for them. However
    this type change was botched and some functions were still using
    32-bit arguments. Change to 64-bit types.

    Thanks Quasar for reporting this. This fixes #438.
---
 opl/opl.c          | 4 ++--
 opl/opl.h          | 4 ++--
 opl/opl_internal.h | 2 +-
 opl/opl_sdl.c      | 3 +--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/opl/opl.c b/opl/opl.c
index 982fb814..2800f434 100644
--- a/opl/opl.c
+++ b/opl/opl.c
@@ -357,7 +357,7 @@ void OPL_InitRegisters(void)
 // Timer functions.
 //

-void OPL_SetCallback(unsigned int us, opl_callback_t callback, void *data)
+void OPL_SetCallback(uint64_t us, opl_callback_t callback, void *data)
 {
     if (driver != NULL)
     {
@@ -409,7 +409,7 @@ static void DelayCallback(void *_delay_data)
     SDL_UnlockMutex(delay_data->mutex);
 }

-void OPL_Delay(unsigned int us)
+void OPL_Delay(uint64_t us)
 {
     delay_data_t delay_data;

diff --git a/opl/opl.h b/opl/opl.h
index 0af8bc17..c4b91b25 100644
--- a/opl/opl.h
+++ b/opl/opl.h
@@ -110,7 +110,7 @@ void OPL_InitRegisters(void);
 // Set a timer callback.  After the specified number of microseconds
 // have elapsed, the callback will be invoked.

-void OPL_SetCallback(unsigned int us, opl_callback_t callback, void *data);
+void OPL_SetCallback(uint64_t us, opl_callback_t callback, void *data);

 // Adjust callback times by the specified factor. For example, a value of
 // 0.5 will halve all remaining times.
@@ -132,7 +132,7 @@ void OPL_Unlock(void);

 // Block until the specified number of microseconds have elapsed.

-void OPL_Delay(unsigned int us);
+void OPL_Delay(uint64_t us);

 // Pause the OPL callbacks.

diff --git a/opl/opl_internal.h b/opl/opl_internal.h
index 2d027ad8..452b8e3d 100644
--- a/opl/opl_internal.h
+++ b/opl/opl_internal.h
@@ -25,7 +25,7 @@ typedef int (*opl_init_func)(unsigned int port_base);
 typedef void (*opl_shutdown_func)(void);
 typedef unsigned int (*opl_read_port_func)(opl_port_t port);
 typedef void (*opl_write_port_func)(opl_port_t port, unsigned int value);
-typedef void (*opl_set_callback_func)(unsigned int us,
+typedef void (*opl_set_callback_func)(uint64_t us,
                                       opl_callback_t callback,
                                       void *data);
 typedef void (*opl_clear_callbacks_func)(void);
diff --git a/opl/opl_sdl.c b/opl/opl_sdl.c
index fa9f047a..8834ee07 100644
--- a/opl/opl_sdl.c
+++ b/opl/opl_sdl.c
@@ -457,8 +457,7 @@ static void OPL_SDL_PortWrite(opl_port_t port, unsigned int value)
     }
 }

-static void OPL_SDL_SetCallback(unsigned int us,
-                                opl_callback_t callback,
+static void OPL_SDL_SetCallback(uint64_t us, opl_callback_t callback,
                                 void *data)
 {
     SDL_LockMutex(callback_queue_mutex);