Skip to content
Open
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ $(TARGET).gba.nds: $(TARGET).nds
cat ndsloader.bin $(TARGET).nds > $(TARGET).gba.nds

#---------------------------------------------------------------------------------
$(TARGET).nds : libdsmi libntxm tobkit $(TARGET).arm7 $(TARGET).arm9
ndstool -c $(TARGET).nds -7 $(TARGET).arm7 -9 $(TARGET).arm9 -b icon.bmp "NitroTracker"
$(TARGET).nds : libdsmi libntxm tobkit arm7/$(TARGET).elf arm9/$(TARGET).elf
ndstool -c $(TARGET).nds -7 arm7/$(TARGET).arm7.elf -9 arm9/$(TARGET).arm9.elf -b icon.bmp "NitroTracker"

#---------------------------------------------------------------------------------
$(TARGET).arm7 : arm7/$(TARGET).elf
Expand All @@ -65,7 +65,7 @@ arm9/$(TARGET).elf:
clean:
$(MAKE) -C arm9 clean
$(MAKE) -C arm7 clean
rm -f $(TARGET).ds.gba $(TARGET).nds $(TARGET).arm7 $(TARGET).arm9
rm -f $(TARGET).ds.gba $(TARGET).nds

# Custom targets for copying stuff to the DS
-include mytargets.mk
Expand Down
6 changes: 0 additions & 6 deletions arm7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ LIBDIRS := $(LIBNDS) $(LIBNTXM)
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export ARM7BIN := $(TOPDIR)/$(TARGET).arm7
export ARM7ELF := $(CURDIR)/$(TARGET).arm7.elf
export DEPSDIR := $(CURDIR)/$(BUILD)

Expand Down Expand Up @@ -113,11 +112,6 @@ DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(ARM7BIN) : $(ARM7ELF)
@$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)


$(ARM7ELF) : $(OFILES) $(LIBNTXM)
@echo linking $(notdir $@)
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
Expand Down
43 changes: 11 additions & 32 deletions arm7/source/arm7_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

extern "C" {
#include "ntxm/linear_freq_table.h"
#include "ntxm/tobmic.h"
}

#define WIFI
Expand All @@ -37,30 +36,16 @@ extern "C" {
#include <dswifi7.h>
#endif

#define LID_BIT BIT(7)

#define abs(x) ((x)>=0?(x):-(x))

NTXM7 *ntxm7 = 0;

bool lidwasdown = false;
static volatile bool exitflag = false;
extern bool ntxm_recording;

int vcount;
touchPosition first,tempPos;

// Thanks to LiraNuna for this cool function
void PM_SetRegister(int reg, int control)
{
SerialWaitBusy();
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER |SPI_BAUD_1MHz | SPI_CONTINUOUS;
REG_SPIDATA = reg;
SerialWaitBusy();
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER |SPI_BAUD_1MHz;
REG_SPIDATA = control;
}


//---------------------------------------------------------------------------------
void VcountHandler() {
//---------------------------------------------------------------------------------
Expand All @@ -73,18 +58,6 @@ void VcountHandler() {

void VblankHandler(void)
{
if((!lidwasdown)&&(REG_KEYXY & LID_BIT))
{
PM_SetRegister(0, 0x30);
lidwasdown = true;
}

if((lidwasdown)&&(!(REG_KEYXY & LID_BIT)))
{
PM_SetRegister(0, 0x0D);
lidwasdown = false;
}

#ifdef WIFI
if(ntxm_recording == false)
Wifi_Update(); // update wireless in vblank
Expand All @@ -105,13 +78,18 @@ void enableSound() {
REG_MASTER_VOLUME = 127;
}

void powerButtonHandler(void) {
exitflag = true;
}

//---------------------------------------------------------------------------------
int main(int argc, char ** argv) {
//---------------------------------------------------------------------------------
readUserSettings(); // read User Settings from firmware
rtcReset(); // Reset the clock if needed
irqInit();
fifoInit();
touchInit();
#ifdef WIFI
installWifiFIFO();
#endif
Expand All @@ -124,9 +102,6 @@ int main(int argc, char ** argv) {
irqSet(IRQ_VCOUNT, VcountHandler);
irqEnable(IRQ_VCOUNT);

irqSet(IRQ_TIMER1, tob_ProcessMicrophoneTimerIRQ);
irqEnable(IRQ_TIMER1);

#ifdef WIFI
irqEnable(IRQ_NETWORK);
#endif
Expand All @@ -140,8 +115,12 @@ int main(int argc, char ** argv) {
irqSet(IRQ_TIMER0, ntxmTimerHandler);
irqEnable(IRQ_TIMER0);

setPowerButtonCB(powerButtonHandler);

// Keep the ARM7 out of main RAM
while (1) {
while (!exitflag) {
swiWaitForVBlank();
}

return 0;
}
7 changes: 1 addition & 6 deletions arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti

ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s

LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
Expand All @@ -66,7 +66,6 @@ LIBDIRS := $(LIBDSMI) $(LIBNTXM) $(TOPDIR)/tobkit $(LIBNDS)
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export ARM9BIN := $(TOPDIR)/$(TARGET).arm9
export ARM9ELF := $(CURDIR)/$(TARGET).arm9.elf
export DEPSDIR := $(CURDIR)/$(BUILD)

Expand Down Expand Up @@ -122,10 +121,6 @@ DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(ARM9BIN) : $(ARM9ELF)
@$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)

$(ARM9ELF) : $(OFILES)
@echo linking $(notdir $@)
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
Expand Down
Loading