main.c
1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*============================================================================
NINTENDO64 TECHNICAL SUPPORT CENTER
NINTENDO64 SAMPLE PROGRAM 2
Copyright (C) 1997, NINTENDO Co,Ltd.
============================================================================*/
#include <ultra64.h>
#include <PR/ramrom.h>
#include <assert.h>
#include "def.h"
#include "vram.h"
#include "segment.h"
#include "message.h"
#include "nnsched.h"
#include "main.h"
#include "controller.h"
#include "audio.h"
#include "graphic.h"
NNSched sched;
int main_no;
/* 外部関数宣言 */
extern int main00(NNSched* );
/*------------------------
mainproc
--------------------------*/
void mainproc(void* arg)
{
/* initialize audio */
auAudioInit();
/* initialize sequence player */
auSeqPlayerInit(_midibankSegmentRomStart, _midibankSegmentRomEnd,
_seqSegmentRomStart, _seqSegmentRomEnd,
_miditableSegmentRomStart);
/* initialize sound player */
auSndPlayerInit(_sfxbankSegmentRomStart, _sfxbankSegmentRomEnd,
_sfxtableSegmentRomStart);
/* create scheduler thread */
nnScCreateScheduler(&sched, OS_VI_NTSC_LAN1, 1);
/* create audio thread */
auCreateAudioThread(&sched);
/* graphic library の初期化 */
gfxInit(_gfxdlistSegmentStart);
/* craete graphic thread */
gfxCreateGraphicThread(&sched);
/*
VIインターフェイスの設定
OS_VI_DITHER_FILTER_ONを指定することでDITHERフィルターを使用できるように
する。
*/
osViSetSpecialFeatures( OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF
| OS_VI_GAMMA_DITHER_OFF);
/* initialize controller (use max 4 controller)*/
controllerInit(4);
controllerThreadMake(&sched);
main_no = MAIN_00;
/* game main loop */
while(1){
switch(main_no){
case MAIN_00: /* main 00 */
main_no = main00(&sched);
break;
case MAIN_01: /* main 01 */
break;
case MAIN_02:
break;
case MAIN_03:
break;
case MAIN_04:
break;
}
} /* end of while */
}