Skip to content

Commit

Permalink
bfsmacklib: Remade DEFSMACKTIMERSETUP()
Browse files Browse the repository at this point in the history
  • Loading branch information
mefistotelis committed Jun 30, 2024
1 parent 55c9bea commit 5347b50
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
10 changes: 5 additions & 5 deletions bfsmacklib/src/bfsmacklib_s.sx
Original file line number Diff line number Diff line change
Expand Up @@ -10217,11 +10217,11 @@ smkmalloc_:


/*----------------------------------------------------------------*/
DEFSMACKTIMERSETUP: /* 10f110 */
GLOBAL_FUNC (ASM_DEFSMACKTIMERSETUP) /* 10f110 */
/*----------------------------------------------------------------*/
mov $ac_DEFSMACKTIMERREAD,%edx
mov $0x46c,%eax
mov $DEFSMACKTIMERDONE,%ebx
mov $ac_DEFSMACKTIMERDONE,%ebx
mov %edx,SmackTimerReadAddr

/* XXX: mov (%eax),%eax */
Expand Down Expand Up @@ -10250,13 +10250,13 @@ DEFSMACKTIMERSETUP: /* 10f110 */


/*----------------------------------------------------------------*/
DEFSMACKTIMERDONE: /* 0x10F150 */
GLOBAL_FUNC (ASM_DEFSMACKTIMERDONE) /* 0x10F150 */
/*----------------------------------------------------------------*/
ret


/*----------------------------------------------------------------*/
ASM_DEFSMACKTIMERREAD:
GLOBAL_FUNC (ASM_DEFSMACKTIMERREAD)
/*----------------------------------------------------------------*/
mov $0x46c,%eax
mov _lasttimerread,%edx
Expand Down Expand Up @@ -10695,7 +10695,7 @@ data_159a00:
GLOBAL (SmackTimerReadAddr) /* 0x159780 */
.long 0x0
GLOBAL (SmackTimerSetupAddr)
.long DEFSMACKTIMERSETUP
.long ac_DEFSMACKTIMERSETUP
GLOBAL (SmackTimerDoneAddr)
.long 0x0

Expand Down
26 changes: 25 additions & 1 deletion bfsmacklib/src/smack2ail.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,31 @@ uint32_t RADAPI DEFSMACKTIMERREAD(void)
#endif
}

/** Default timer finish routine.
*/
void RADAPI DEFSMACKTIMERDONE(void)
{
}

uint32_t RADAPI ac_DEFSMACKTIMERREAD(void);
void RADAPI ac_DEFSMACKTIMERDONE(void);

/** Default timer initialization routine.
*/
void RADAPI DEFSMACKTIMERSETUP(void)
{
SmackTimerReadAddr = ac_DEFSMACKTIMERREAD;
SmackTimerDoneAddr = ac_DEFSMACKTIMERDONE;
#if defined(DOS)||defined(GO32)
uint32_t tick = PEEKL(0x46C);
timeradjust = -tick;
// Setup 82C54 timer tick to count to 65536 (results in 18.2 IRQs per second)
outb(0x43, 0x34);
outb(0x40, 0);
outb(0x40, 0);
#endif
}

/** Timer routine when linked to AIL; returns a timer value, in miliseconds.
*/
uint32_t RADAPI MSSSMACKTIMERREAD(void)
Expand All @@ -150,7 +175,6 @@ void RADAPI ac_MSSSMACKTIMERSETUP(void);
void RADAPI ac_MSSSMACKTIMERDONE(void);
void RADAPI ac_MSSLOWSOUNDCHECK(void);
void RADAPI ac_MSSLOWSOUNDVOLPAN(uint32_t pan, uint32_t volume, SmackSndTrk *sstrk);
uint32_t RADAPI ac_DEFSMACKTIMERREAD(void);
uint32_t RADAPI ac_MSSSMACKTIMERREAD(void);


Expand Down
2 changes: 2 additions & 0 deletions conf/wrappers_game.conf
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,8 @@ SetCDAudioVolume W v i
FreeCDAudio W v
FreeCD W v
DEFSMACKTIMERREAD S i
DEFSMACKTIMERDONE S v
DEFSMACKTIMERSETUP S v
MSSSMACKTIMERREAD S i
MSSLOWSOUNDOPEN S i ip
MSSLOWSOUNDCLOSE S v p
Expand Down

0 comments on commit 5347b50

Please sign in to comment.