DOOM64-RE

DOOM 64 Reverse Engineering
Log | Files | Refs | README | LICENSE

wessapic.c (1589B)


      1 
      2 /* WESS API INCLUDES */
      3 #include "wessapi.h"	// audio stuff...
      4 #include "seqload.h"
      5 #include "soundhw.h"
      6 #include "wessarc.h"
      7 #include "wessseq.h"
      8 
      9 #include "funqueue.h"
     10 
     11 #include "graph.h" // debug
     12 
     13 #ifndef NOUSEWESSCODE
     14 extern pmasterstat *pm_stat;    //0x800B41CC
     15 
     16 void wess_register_callback(char marker_ID, void(*function_pointer)(char, short)) // 80030EF0
     17 {
     18 	static char si, sn;				//800B41D0, 800B41D1
     19 	static callback_status *cbs;	//800B41D4
     20 
     21 	char _marker_ID;
     22 	void(*_function_pointer)(char, short);
     23 
     24 	_marker_ID = marker_ID;
     25 	_function_pointer = function_pointer;
     26 
     27 	if (!Is_Module_Loaded())
     28 	{
     29 		return;
     30 	}
     31 
     32 	wess_disable();
     33 
     34 	sn = pm_stat->callbacks_active;
     35 	si = wess_driver_callbacks;
     36 	if (sn != si) /* check if we are full of callbacks */
     37 	{
     38 		cbs = pm_stat->pcalltable;
     39 		while (si--)
     40 		{
     41 			if (!cbs->active)
     42 			{
     43 			    cbs->curval = 0;
     44 				cbs->type = _marker_ID;
     45 				cbs->callfunc = _function_pointer;
     46 				pm_stat->callbacks_active++;
     47 				break;
     48 			}
     49 			cbs++;
     50 		}
     51 	}
     52 
     53 	wess_enable();
     54 }
     55 
     56 void wess_delete_callback(char marker_ID) // 80030FF0
     57 {
     58 	static char si, sn;				//800B41D8, 800B41D9
     59 	static callback_status *cbs;	//800B41DC
     60 
     61 	char _marker_ID;
     62 
     63 	_marker_ID = marker_ID;
     64 
     65 	if (!Is_Module_Loaded())
     66 	{
     67 		return;
     68 	}
     69 
     70 	wess_disable();
     71 
     72 	sn = pm_stat->callbacks_active;
     73 	if (sn)
     74 	{
     75 		cbs = pm_stat->pcalltable;
     76 		si = wess_driver_callbacks;
     77 		while (si--)
     78 		{
     79 			if (cbs->active)
     80 			{
     81 				if (cbs->type == _marker_ID)
     82 				{
     83 					cbs->active = 0;
     84 					--pm_stat->callbacks_active;
     85 					break;
     86 				}
     87 				if (!--sn) break;
     88 			}
     89 			cbs++;
     90 		}
     91 	}
     92 
     93 	wess_enable();
     94 }
     95 
     96 #endif