aboutsummaryrefslogtreecommitdiff
path: root/source/nds/ds2_main.c
blob: af81df30ab0610c42cac34237733ac2753a152ad (plain)
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
/* ds2_main.c
 *
 * Copyright (C) 2010 dking <dking024@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public Licens e as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include "port.h"

#include <stdio.h>
#include "console.h"
#include "fs_api.h"
#include "ds2io.h"
#include "ds2_cpu.h"
#include "ds2_timer.h"
#include "ds2_malloc.h"
#include "ds2sound.h"
#include "gui.h"

#define BLACK_COLOR		RGB15(0, 0, 0)
#define WHITE_COLOR		RGB15(31, 31, 31)

extern int sfc_main (int argc, char **argv);

#if 0
void ddump_mem(unsigned char* addr, unsigned int len)
{
	unsigned int i;

	for(i= 0; i < len; i++)
	{
		if(i%16 == 0) cprintf("\n%08x: ", i);
		cprintf("%02x ", addr[i]);
	}
}
#endif

void ds2_main(void)
{
	int err;
	HighFrequencyCPU();
	//Initial video and audio and other input and output
	err = ds2io_initb(DS2_BUFFER_SIZE, SND_SAMPLE_RATE, 0, 0);
	if(err) goto _failure;

	//Initial file system
	err = fat_init();
	if(err) goto _failure;

	//go to user main funtion
	sfc_main (0, 0);

_failure:
	ds2_plug_exit();
}