<commit_before>#include "demoRunner.h"
#include <nds/arm9/video.h>
#include <nds/interrupts.h>
#include <nds/system.h>

#include "demo.h"

DemoRunner runner;

DemoRunner::DemoRunner() {
}
void DemoRunner::start() {
	irqSet(IRQ_HBLANK, hBlankHandler);
	irqEnable(IRQ_HBLANK);
}
void DemoRunner::stop() {
	irqDisable(IRQ_HBLANK);
}
DemoRunner::~DemoRunner() {
	if(demoPtr) {
		demoPtr->Unload();
	}
	stop();
}

void DemoRunner::hBlankHandler() {
	runner.runCurrentLineFromBatch();
}

void DemoRunner::runCurrentLineFromBatch() {
	int nextLine=REG_VCOUNT+1;
	if(nextLine>=SCREEN_HEIGHT) return;
	batcher.ApplyPokesForLine(nextLine);
}

void DemoRunner::tick() {
	batcher.Clear();
	demoPtr->tick();
	batcher.ApplyPokesForLine(0);
}

void DemoRunner::operator=(std::shared_ptr<Demo> d) {
	RunDemo(d);
}
<commit_msg>Universal bail out to menu<commit_after>#include "demoRunner.h"
#include <nds/arm9/video.h>
#include <nds/interrupts.h>
#include <nds/system.h>
#include <nds/arm9/input.h>

#include "demo.h"
#include "menuDemo.h"

DemoRunner runner;

DemoRunner::DemoRunner() {
}
void DemoRunner::start() {
	irqSet(IRQ_HBLANK, hBlankHandler);
	irqEnable(IRQ_HBLANK);
}
void DemoRunner::stop() {
	irqDisable(IRQ_HBLANK);
}
DemoRunner::~DemoRunner() {
	if(demoPtr) {
		demoPtr->Unload();
	}
	stop();
}

void DemoRunner::hBlankHandler() {
	runner.runCurrentLineFromBatch();
}

void DemoRunner::runCurrentLineFromBatch() {
	int nextLine=REG_VCOUNT+1;
	if(nextLine>=SCREEN_HEIGHT) return;
	batcher.ApplyPokesForLine(nextLine);
}

void DemoRunner::tick() {
	auto keys = keysDown();
	batcher.Clear();
	if(keys & KEY_SELECT) {
		RunDemo(std::make_shared<MenuDemo>());
	}
	demoPtr->tick();
	batcher.ApplyPokesForLine(0);
}

void DemoRunner::operator=(std::shared_ptr<Demo> d) {
	RunDemo(d);
}

{'fraction_non_alphanumeric': 0.16882386043894204, 'fraction_numerical': 0.0039392234102419805, 'mean_word_length': 6.798245614035087, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6406818', 'n_tokens_mistral': 734, 'n_tokens_neox': 716, 'n_words': 102}