aboutsummaryrefslogtreecommitdiff
path: root/source/nds/ds2_main.c
diff options
context:
space:
mode:
authorNebuleon Fumika2012-12-21 03:50:10 -0500
committerNebuleon Fumika2012-12-21 03:50:10 -0500
commita0d0c5e7a5bdc396b4c370a750273b6e3b963bb0 (patch)
tree6bc433422db602b974a01dffbfc5ce5d84afc578 /source/nds/ds2_main.c
parent3972512b2a5c25236ea3ba586621dba6e5b56361 (diff)
downloadsnes9x2005-a0d0c5e7a5bdc396b4c370a750273b6e3b963bb0.tar.gz
snes9x2005-a0d0c5e7a5bdc396b4c370a750273b6e3b963bb0.tar.bz2
snes9x2005-a0d0c5e7a5bdc396b4c370a750273b6e3b963bb0.zip
Eliminate the latency of button press recognition, which was bad enough to lose keys entirely sometimes, and could otherwise delay a button press or release by 200 ms.
This was the entire reason I created the fork, and I finally did it! It syncs the controls every scanline of a frame, which costs about 60,000 MIPS instructions per frame to deal with. Luckily, the processor runs at 396 MHz, which means the cost of checking the controls is 1% of the CPU's power.
Diffstat (limited to 'source/nds/ds2_main.c')
-rw-r--r--source/nds/ds2_main.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/source/nds/ds2_main.c b/source/nds/ds2_main.c
index 710215b..2d73313 100644
--- a/source/nds/ds2_main.c
+++ b/source/nds/ds2_main.c
@@ -15,19 +15,19 @@
* 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 <stdio.h>
-#include "console.h"
-#include "fs_api.h"
+ */
+
+#include <stdio.h>
+#include "console.h"
+#include "fs_api.h"
#include "ds2io.h"
#include "ds2_timer.h"
#include "ds2_malloc.h"
-
-#define BLACK_COLOR RGB15(0, 0, 0)
-#define WHITE_COLOR RGB15(31, 31, 31)
-
-extern int sfc_main (int argc, char **argv);
+
+#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)
@@ -42,24 +42,22 @@ void ddump_mem(unsigned char* addr, unsigned int len)
}
#endif
+void ds2_main(void)
+{
+ int err;
+ds2_setCPUclocklevel(13);
+ //Initial video and audio and other input and output
+ err = ds2io_initb(512, 22050, 0, 0);
+ if(err) goto _failure;
-
-void ds2_main(void)
-{
- int err;
-ds2_setCPUclocklevel(13);
- //Initial video and audio and other input and output
- err = ds2io_initb(512, 22050, 0, 0);
- if(err) goto _failure;
+ //Initial file system
+ err = fat_init();
+ if(err) goto _failure;
- //Initial file system
- err = fat_init();
- if(err) goto _failure;
+ //go to user main funtion
+ sfc_main (0, 0);
- //go to user main funtion
- sfc_main (0, 0);
-
_failure:
- ds2_plug_exit();
-}
-
+ ds2_plug_exit();
+}
+