Пример #1
0
SVResString::SVResString(string szResLanguage, string szAddr):
m_szResLanguage(szResLanguage),
m_szResAddr(szAddr)
{
    m_objRes = INVALID_VALUE;
    loadStrings();
}
Пример #2
0
CSVWholeview::CSVWholeview(WContainerWidget *parent, string szIDCUser, string szIDCPwd):
WTable(parent)
{
    m_szIDCUser = szIDCUser;
    m_szIDCPwd  = szIDCPwd;

    m_szUserID  = "";
    m_bFirstLoad   = true;

    m_pTime     = NULL;
    m_pContent  = NULL;
    m_pSVUser   = NULL;


	//new WText("<div id='view_panel' class='panel_view'>",elementAt(0, 0));

    new WText("\n<SCRIPT language='JavaScript' src='/basic.js'></SCRIPT>", elementAt(0, 0));


    loadStrings();
    //initForm();
	NewInitForm();


	//new WText("</div>", elementAt(0, 0));

	//AddJsParam("uistyle", "viewpan");
	//AddJsParam("fullstyle", "true");
	//AddJsParam("bGeneral", "false");
	//new WText("<SCRIPT language='JavaScript' src='/Script.js'></SCRIPT>", elementAt(0, 0));

}
 void BoostPropertyTree::loadStrings(int argc, const char ** argv)
 {
   std::vector<std::string> v;
   for(int i = 0; i < argc; i++){
     v.push_back(argv[i]);
   }
   loadStrings(v);
 }
Пример #4
0
void switchStrings()
{
	if (fontIsLoaded) {
		preloadStringsA();
		preloadStringsU();
		loadStrings();
	} else
		mbstowcs(strings[STR_LANG_NAME], cfgs[CFG_LANG].val.s, STR_MAX_LEN);
}
Пример #5
0
void GFF4File::load(uint32 type) {
	try {

		loadHeader(type);
		loadStructs();
		loadStrings();

	} catch (Common::Exception &e) {
		clear();

		e.add("Failed reading GFF4 file");
		throw;
	}
}
Пример #6
0
/**
 * \brief load a language definition from an XML file stored on the disk
 * \param doc the dom document from which the language should be loaded.
 * \return true on sucess, false on any error
 *
 * Loads the language definition from the XML document \b doc.
 * Basic checks are done on the synatx, the error checking is very
 * minimal, so having a good valid XML is a good idea with this
 * implementation.
 */
bool	QsvLangDef::load( QDomDocument doc )
{
	QDomNodeList list, l;
	QDomNode n,m;

	// read information about this syntax highlight
	list = doc.elementsByTagName("language");
	n = list.item(0);

	// we assume that if the fist line is well decalred, everything else is cool
	if (! n.hasAttributes() ) 
		return false;

	name		= n.attributes().namedItem("_name").nodeValue();
	version		= n.attributes().namedItem("_version").nodeValue();
	section		= n.attributes().namedItem("_section").nodeValue();
	mimeTypes	= n.attributes().namedItem("mimetypes").nodeValue().split(QRegExp("[;,]"));
	extensions	= n.attributes().namedItem("extensions").nodeValue().split(";");

	// read the entities which define this language/syntax
	list = doc.elementsByTagName("escape-char");
	escapeChar = list.item(0).nodeValue();

	if (!loadLineComments( doc.elementsByTagName("line-comment") ))	
		return false;

	if (!loadStrings( doc.elementsByTagName("string") ))
		return false;

	if (!loadPatternItems( doc.elementsByTagName("pattern-item")))
		return false;

	if (!loadBlockComments( doc.elementsByTagName("block-comment"), blockCommentsDefs ))
		return false;

	if (!loadKeywordList( doc.elementsByTagName("keyword-list") ))
		return false;

	if (!loadBlockComments( doc.elementsByTagName("syntax-item"), syntaxItemDefs ))
		return false;

	return true;
};
Пример #7
0
/*!
 *
 * \param data       CDT for the CEmoticon class
 * \param themedir   path to the theme directory
 * \param list       list where the results are stored
 *
 * \returns the number of loaded emoticons
 */
static unsigned loadTheme(const struct Emoticons *data,
                          const QString &themedir,
                          node_list_t &list)
{
  QDomDocument doc("doc");
  QFile file(themedir + "/emoticons.xml");
  unsigned ret = 0;

  if (file.open(IO_ReadOnly) && doc.setContent(&file))
  {
    QDomElement elem = doc.documentElement();
    QDomNode n = elem.firstChild();
    for (; !n.isNull(); n = n.nextSibling())
    {
      if (n.isElement())
      {
        elem = n.toElement();
        if (!elem.isNull() && elem.tagName() == QString::fromLatin1("emoticon"))
        {
          QString file = elem.attribute("file");
          QString f=realFile(data,themedir,file);
          if (f != QString::null)
          {
            struct node node;
            unsigned size;

            node.emoticon = loadStrings(data, n.firstChild(), &size);
	    if (size)
	    {
	      node.file = f;
	      create_regexp(node.emoticon, node.reg);
	      list.push_back(node);
	      ret += size;
	    }
          }
        }
      }
    }
  }

  file.close();
  return ret;
};
Пример #8
0
/*
 * Initialize the ES.  Read builtin data into ES.
 */
esinit()
{
	FILE	*f;
	int ret;
#ifndef OLMSG
	static char	esiErr[] =	"Error reading /config/abbuiltin";
#endif

	printt0("esinit()\n");

	allocES();			/* alloc segment and set ES */

	if ((f = fopen(ESBUILTIN, "r")) == NULL || loadBuiltin(f)
					|| loadStrings(f) || loadErrors(f))
		error(ER(57,esiErr));
	fclose(f);
	printt0( "es init finished\n" );

}
Пример #9
0
void trySetLangFromTheme(){
	File MyFile;
	char str[100];
	unsigned int i;

	sprintf(str, "/rxTools/Theme/%u/LANG.txt", cfgs[CFG_THEME].val.i);
	if (!FileOpen(&MyFile, str, 0))
		return;
	if (FileGetSize(&MyFile) > 0)
	{
		FileRead(&MyFile, cfgs[CFG_LANG].val.s, CFG_STR_MAX_LEN, 0);

		for (i = 0; i + 1 < CFG_STR_MAX_LEN
			&& cfgs[CFG_LANG].val.s[i] != '\r'
			&& cfgs[CFG_LANG].val.s[i] != '\n'; i++);
		str[i] = 0;

		loadStrings();
	}
	FileClose(&MyFile);
}
Пример #10
0
void
TimeZoneNamesImpl::initialize(const Locale& locale, UErrorCode& status) {
    if (U_FAILURE(status)) {
        return;
    }

    // Load zoneStrings bundle
    UErrorCode tmpsts = U_ZERO_ERROR;   // OK with fallback warning..
    fZoneStrings = ures_open(U_ICUDATA_ZONE, locale.getName(), &tmpsts);
    fZoneStrings = ures_getByKeyWithFallback(fZoneStrings, gZoneStrings, fZoneStrings, &tmpsts);
    if (U_FAILURE(tmpsts)) {
        status = tmpsts;
        cleanup();
        return;
    }

    // Initialize hashtables holding time zone/meta zone names
    fMZNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
    fTZNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
    if (U_FAILURE(status)) {
        cleanup();
        return;
    }

    uhash_setValueDeleter(fMZNamesMap, deleteZNames);
    uhash_setValueDeleter(fTZNamesMap, deleteTZNames);
    // no key deleters for name maps

    // preload zone strings for the default zone
    TimeZone *tz = TimeZone::createDefault();
    const UChar *tzID = ZoneMeta::getCanonicalCLDRID(*tz);
    if (tzID != NULL) {
        loadStrings(UnicodeString(tzID));
    }
    delete tz;

    return;
}
Пример #11
0
__attribute__((section(".text.start"), noreturn)) void _start()
{
	static const TCHAR fontPath[] = _T("") SYS_PATH "/" FONT_NAME;
	void *fontBuf;
	UINT btr, br;
	int r;
	FIL f;

	// Enable TMIO IRQ
	*(volatile uint32_t *)0x10001000 = 0x00010000;

	preloadStringsA();

	
	if (!FSInit()) {
		DrawString(BOT_SCREEN, strings[STR_FAILED],
			BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK);
		while (1);
	}

	
	set_loglevel(ll_info);
	log(ll_info, "Initializing rxTools...");
	

	setConsole();

	fontIsLoaded = 0;
	r = f_open(&f, fontPath, FA_READ);
	if (r == FR_OK) {
		btr = f_size(&f);
		fontBuf = __builtin_alloca(btr);
		r = f_read(&f, fontBuf, btr, &br);
		if (r == FR_OK)
			fontIsLoaded = 1;

		f_close(&f);
		fontaddr = fontBuf;
	}

	if (fontIsLoaded)
		preloadStringsU();
	else
		warn(L"Failed to load " FONT_NAME ": %d\n", r);

	if (getMpInfo() == MPINFO_KTR)
    {
        r = initN3DSKeys();
        if (r != FR_OK) {
            warn(L"Failed to load keys for N3DS\n"
            "  Code: %d\n"
            "  RxMode will not boot. Please\n"
            "  include key_0x16.bin and\n"
            "  key_0x1B.bin at the root of your\n"
            "  SD card.\n", r);
            InputWait();
            goto postinstall;
        }
    }


	install();
	postinstall:
	readCfg();

	log(ll_info, "Done...");

	r = loadStrings();
	if (r)
		warn(L"Failed to load strings: %d\n", r);

	drawTop();

	//Default boot check
	if (cfgs[CFG_DEFAULT].val.i && HID_STATE & BUTTON_L1)
		{
			if(cfgs[CFG_DEFAULT].val.i == 3) PastaMode();
			else rxMode(cfgs[CFG_DEFAULT].val.i - 1);
		}

	if (sysver < 7) {
		r = initKeyX();
		if (r != FR_OK)
			warn(L"Failed to load key X for slot 0x25\n"
				"  Code: %d\n"
				"  If your firmware version is less\n"
				"  than 7.X, some titles decryption\n"
				"  will fail, and some EmuNANDs\n"
				"  will not boot.\n", r);
	}

	if (warned) {
		warn(strings[STR_PRESS_BUTTON_ACTION],
			strings[STR_BUTTON_A], strings[STR_CONTINUE]);
		WaitForButton(BUTTON_A);
	}

	OpenAnimation();
	mainLoop();
}
Пример #12
0
int Initialize()
{
	char str[100];
	char strl[100];
	char strr[100];
	char tmp[256];
	wchar_t wtmp[256];
	int r;

	preloadStringsA();

	DrawString(BOT_SCREEN, strings[STR_INITIALIZING], FONT_WIDTH, SCREEN_HEIGHT-FONT_HEIGHT, WHITE, BLACK);

	if(FSInit()){
		DrawString(BOT_SCREEN, strings[STR_LOADING], BOT_SCREEN_WIDTH/2, SCREEN_HEIGHT-FONT_HEIGHT, WHITE, BLACK);
	}else{
		DrawString(BOT_SCREEN, strings[STR_FAILED], BOT_SCREEN_WIDTH/2, SCREEN_HEIGHT-FONT_HEIGHT, RED, BLACK);
		return 1;
	}

	LoadFont();
	if (fontLoaded){
		swprintf(wtmp, sizeof(wtmp)/sizeof(wtmp[0]), strings[STR_ERROR_OPENING], fontpath);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT-FONT_HEIGHT*2, RED, BLACK);
	}else{
		preloadStringsU();
	}

	//Console Stuff
	ConsoleSetXY(15, 20);
	ConsoleSetWH(BOT_SCREEN_WIDTH-30, SCREEN_HEIGHT-80);
	ConsoleSetBorderColor(BLUE);
	ConsoleSetTextColor(RGB(0, 141, 197));
	ConsoleSetBackgroundColor(TRANSPARENT);
	ConsoleSetSpecialColor(BLUE);
	ConsoleSetSpacing(2);
	ConsoleSetBorderWidth(3);
	//Check that the data is installed
	f_mkdir("rxTools");
	f_mkdir("rxTools/nand");
	InstallConfigData();
	readCfg();

	if (fontLoaded)
		cfgs[CFG_LANG].val.s = cfgLang;
	r = loadStrings();
	if (r) {
		sprintf(tmp, "%s/%s", langPath, cfgs[CFG_LANG].val.s);
		swprintf(wtmp, sizeof(wtmp)/sizeof(wtmp[0]), strings[STR_ERROR_OPENING], tmp);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT-FONT_HEIGHT*3, RED, BLACK);
	}
	sprintf(str, "/rxTools/Theme/%u/TOP.bin", cfgs[CFG_THEME].val.i);
	sprintf(strl, "/rxTools/Theme/%u/TOPL.bin", cfgs[CFG_THEME].val.i);
	sprintf(strr, "/rxTools/Theme/%u/TOPR.bin", cfgs[CFG_THEME].val.i);
	if (cfgs[CFG_3D].val.i)
		DrawTopSplash(str, strl, strr);
	else
		DrawTopSplash(str, str, str);

	if (!cfgs[CFG_GUI].val.i)
	{
		if(cfgs[CFG_SILENT].val.i)
		{
			sprintf(str, "/rxTools/Theme/%u/boot.bin", cfgs[CFG_THEME].val.i);
			DrawBottomSplash(str);

			for (int i = 0; i < 0x333333 * 2; i++){
				uint32_t pad = GetInput();
				if (pad & BUTTON_R1 && i > 0x333333) goto rxTools_boot;
			}
		}
		else
		{
			ConsoleInit();
			ConsoleSetTitle(strings[STR_AUTOBOOT]);
			print(strings[STR_HOLD_BUTTON_ACTION], strings[STR_BUTTON_R], strings[STR_OPEN_MENU]);
			ConsoleShow();

			for (int i = 0; i < 0x333333 * 6; i++){
				uint32_t pad = GetInput();
				if (pad & BUTTON_R1 && i > 0x333333) goto rxTools_boot;
			}
		}
		rxMode(1);
	}
rxTools_boot:
	sprintf(str, "/rxTools/Theme/%u/TOP.bin", cfgs[CFG_THEME].val.i);
	sprintf(strl, "/rxTools/Theme/%u/TOPL.bin", cfgs[CFG_THEME].val.i);
	sprintf(strr, "/rxTools/Theme/%u/TOPR.bin", cfgs[CFG_THEME].val.i);
	if (cfgs[CFG_3D].val.i)
		DrawTopSplash(str, strl, strr);
	else
		DrawTopSplash(str, str, str);

	return 0;
}
Пример #13
0
void
TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
    if (U_FAILURE(status)) {
        return;
    }

    // TimeZoneNames
    fTimeZoneNames = TimeZoneNames::createInstance(locale, status);
    if (U_FAILURE(status)) {
        return;
    }

    // Initialize format patterns
    UnicodeString rpat(TRUE, gDefRegionPattern, -1);
    UnicodeString fpat(TRUE, gDefFallbackPattern, -1);

    UErrorCode tmpsts = U_ZERO_ERROR;   // OK with fallback warning..
    UResourceBundle *zoneStrings = ures_open(U_ICUDATA_ZONE, locale.getName(), &tmpsts);
    zoneStrings = ures_getByKeyWithFallback(zoneStrings, gZoneStrings, zoneStrings, &tmpsts);

    if (U_SUCCESS(tmpsts)) {
        const UChar *regionPattern = ures_getStringByKeyWithFallback(zoneStrings, gRegionFormatTag, NULL, &tmpsts);
        if (U_SUCCESS(tmpsts) && u_strlen(regionPattern) > 0) {
            rpat.setTo(regionPattern, -1);
        }
        tmpsts = U_ZERO_ERROR;
        const UChar *fallbackPattern = ures_getStringByKeyWithFallback(zoneStrings, gFallbackFormatTag, NULL, &tmpsts);
        if (U_SUCCESS(tmpsts) && u_strlen(fallbackPattern) > 0) {
            fpat.setTo(fallbackPattern, -1);
        }
    }
    ures_close(zoneStrings);

    fRegionFormat.applyPatternMinMaxArguments(rpat, 1, 1, status);
    fFallbackFormat.applyPatternMinMaxArguments(fpat, 2, 2, status);
    if (U_FAILURE(status)) {
        cleanup();
        return;
    }

    // locale display names
    fLocaleDisplayNames = LocaleDisplayNames::createInstance(locale);

    // hash table for names - no key/value deleters
    fLocationNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
    if (U_FAILURE(status)) {
        cleanup();
        return;
    }

    fPartialLocationNamesMap = uhash_open(hashPartialLocationKey, comparePartialLocationKey, NULL, &status);
    if (U_FAILURE(status)) {
        cleanup();
        return;
    }
    uhash_setKeyDeleter(fPartialLocationNamesMap, uprv_free);
    // no value deleter

    // target region
    const char* region = fLocale.getCountry();
    int32_t regionLen = uprv_strlen(region);
    if (regionLen == 0) {
        char loc[ULOC_FULLNAME_CAPACITY];
        uloc_addLikelySubtags(fLocale.getName(), loc, sizeof(loc), &status);

        regionLen = uloc_getCountry(loc, fTargetRegion, sizeof(fTargetRegion), &status);
        if (U_SUCCESS(status)) {
            fTargetRegion[regionLen] = 0;
        } else {
            cleanup();
            return;
        }
    } else if (regionLen < (int32_t)sizeof(fTargetRegion)) {
        uprv_strcpy(fTargetRegion, region);
    } else {
        fTargetRegion[0] = 0;
    }

    // preload generic names for the default zone
    TimeZone *tz = TimeZone::createDefault();
    const UChar *tzID = ZoneMeta::getCanonicalCLDRID(*tz);
    if (tzID != NULL) {
        loadStrings(UnicodeString(TRUE, tzID, -1));
    }
    delete tz;
}
Пример #14
0
int Town::townAction(int actionId) {
	Interface &intf = *_vm->_interface;
	Map &map = *_vm->_map;
	Party &party = *_vm->_party;
	Screen &screen = *_vm->_screen;
	Sound &sound = *_vm->_sound;
	bool isDarkCc = _vm->_files->_isDarkCc;

	if (actionId == 12) {
		pyramidEvent();
		return 0;
	}

	_townMaxId = Res.TOWN_MAXES[_vm->_files->_isDarkCc][actionId];
	_townActionId = actionId;
	_drawFrameIndex = 0;
	_v1 = 0;
	_townPos = Common::Point(8, 8);
	intf._overallFrame = 0;

	// This area sets up the GUI buttos and startup sample to play for the
	// given town action
	Common::String vocName = "hello1.voc";
	clearButtons();
	_icons1.clear();
	_icons2.clear();

	switch (actionId) {
	case 0:
		// Bank
		_icons1.load("bank.icn");
		_icons2.load("bank2.icn");
		addButton(Common::Rect(234, 108, 259, 128), Common::KEYCODE_d, &_icons1);
		addButton(Common::Rect(261, 108, 285, 128), Common::KEYCODE_w, &_icons1);
		addButton(Common::Rect(288, 108, 312, 128), Common::KEYCODE_ESCAPE, &_icons1);
		intf._overallFrame = 1;

		sound.stopSound();
		vocName = isDarkCc ? "bank1.voc" : "banker.voc";
		break;
	
	case 1:
		// Blacksmith
		_icons1.load("esc.icn");
		addButton(Common::Rect(261, 100, 285, 120), Common::KEYCODE_ESCAPE, &_icons1);
		addButton(Common::Rect(234, 54, 308, 62), 0);
		addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_b);
		addButton(Common::Rect(234, 74, 308, 82), 0);
		addButton(Common::Rect(234, 84, 308, 92), 0);

		sound.stopSound();
		vocName = isDarkCc ? "see2.voc" : "whaddayo.voc";
		break;

	case 2:
		// Guild
		loadStrings("spldesc.bin");
		_icons1.load("esc.icn");
		addButton(Common::Rect(261, 100, 285, 120), Common::KEYCODE_ESCAPE, &_icons1);
		addButton(Common::Rect(234, 54, 308, 62), 0);
		addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_b);
		addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_s);
		addButton(Common::Rect(234, 84, 308, 92), 0);
		_vm->_mode = MODE_17;

		sound.stopSound();
		vocName = isDarkCc ? "parrot1.voc" : "guild10.voc";
		break;

	case 3:
		// Tavern
		loadStrings("tavern.bin");
		_icons1.load("tavern.icn");
		addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons1);
		addButton(Common::Rect(242, 108, 266, 128), Common::KEYCODE_s, &_icons1);
		addButton(Common::Rect(234, 54, 308, 62), Common::KEYCODE_d);
		addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_f);
		addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_t);
		addButton(Common::Rect(234, 84, 308, 92), Common::KEYCODE_r);
		_vm->_mode = MODE_17;

		sound.stopSound();
		vocName = isDarkCc ? "hello1.voc" : "hello.voc";
		break;

	case 4:
		// Temple
		_icons1.load("esc.icn");
		addButton(Common::Rect(261, 100, 285, 120), Common::KEYCODE_ESCAPE, &_icons1);
		addButton(Common::Rect(234, 54, 308, 62), Common::KEYCODE_h);
		addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_d);
		addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_u);
		addButton(Common::Rect(234, 84, 308, 92), 0);

		sound.stopSound();
		vocName = isDarkCc ? "help2.voc" : "maywe2.voc";
		break;

	case 5:
		// Training
		Common::fill(&_arr1[0], &_arr1[6], 0);
		_v2 = 0;

		_icons1.load("train.icn");
		addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons1);
		addButton(Common::Rect(242, 108, 266, 128), Common::KEYCODE_t);

		sound.stopSound();
		vocName = isDarkCc ? "training.voc" : "youtrn1.voc";
		break;

	case 6:
		// Arena event
		arenaEvent();
		return false;

	case 8:
		// Reaper event
		reaperEvent();
		return false;

	case 9:
		// Golem event
		golemEvent();
		return false;

	case 10:
	case 13:
		dwarfEvent();
		return false;

	case 11:
		sphinxEvent();
		return false;

	default:
		break;
	}

	sound.playSong(Res.TOWN_ACTION_MUSIC[actionId], 223);

	_townSprites.resize(Res.TOWN_ACTION_FILES[isDarkCc][actionId]);
	for (uint idx = 0; idx < _townSprites.size(); ++idx) {
		Common::String shapesName = Common::String::format("%s%d.twn",
			Res.TOWN_ACTION_SHAPES[actionId], idx + 1);
		_townSprites[idx].load(shapesName);
	}

	Character *charP = &party._activeParty[0];
	Common::String title = createTownText(*charP);
	intf._face1UIFrame = intf._face2UIFrame = 0;
	intf._dangerSenseUIFrame = 0; 
	intf._spotDoorsUIFrame = 0;
	intf._levitateUIFrame = 0;

	_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
	if (actionId == 0 && isDarkCc) {
		_townSprites[4].draw(screen, _vm->getRandomNumber(13, 18),
			Common::Point(8, 30));
	}

	intf.assembleBorder();

	// Open up the window and write the string
	screen._windows[10].open();
	screen._windows[10].writeString(title);
	drawButtons(&screen);

	screen._windows[0].update();
	intf.highlightChar(0);
	drawTownAnim(1);

	if (actionId == 0)
		intf._overallFrame = 2;

	sound.playSound(vocName, 1);

	do {
		townWait();
		charP = doTownOptions(charP);
		screen._windows[10].writeString(title);
		drawButtons(&screen);
	} while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE);

	switch (actionId) {
	case 1:
		// Leave blacksmith
		if (isDarkCc) {
			sound.stopSound();
			sound.playSound("come1.voc", 1);
		}
		break;

	case 3: {
		// Leave Tavern
		sound.stopSound();
		sound.playSound(isDarkCc ? "gdluck1.voc" : "goodbye.voc", 1);

		map.mazeData()._mazeNumber = party._mazeId;
		break;
	}
	default:
		break;
	}

	int result;
	if (party._mazeId != 0) {
		map.load(party._mazeId);
		_v1 += 1440;
		party.addTime(_v1);
		result = 0;
	} else {
		_vm->_saves->saveChars();
		result = 2;
	}

	for (uint idx = 0; idx < _townSprites.size(); ++idx)
		_townSprites[idx].clear();
	intf.mainIconsPrint();
	_buttonValue = 0;

	return result;
}
Пример #15
0
__attribute__((section(".text.start"), noreturn)) void _start()
{
	static const TCHAR fontPath[] = _T("") SYS_PATH "/" FONT_NAME;
	void *fontBuf;
	UINT btr, br;
	int r;
	FIL f;

	// Enable TMIO IRQ
	*(volatile uint32_t *)0x10001000 = 0x00010000;

	preloadStringsA();

	if (!FSInit()) {
		DrawString(BOT_SCREEN, strings[STR_FAILED],
			BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK);
		while (1);
	}

	/*
	set_loglevel(ll_info);
	log(ll_info, "Initializing rxTools...");
	*/

	setConsole();

	fontIsLoaded = 0;
	r = f_open(&f, fontPath, FA_READ);
	if (r == FR_OK) {
		btr = f_size(&f);
		fontBuf = __builtin_alloca(btr);
		r = f_read(&f, fontBuf, btr, &br);
		if (r == FR_OK)
			fontIsLoaded = 1;

		f_close(&f);
		fontaddr = fontBuf;
	}

	if (fontIsLoaded)
		preloadStringsU();
	else
		warn(L"Failed to load " FONT_NAME ": %d\n", r);

	install();
	readCfg();

	r = loadStrings();
	if (r)
		warn(L"Failed to load strings: %d\n", r);

	drawTop();

	if (!cfgs[CFG_GUI].val.i && HID_STATE & BUTTON_L1)
		rxMode(cfgs[CFG_ABSYSN].val.i ? 0 : 1);

	if (sysver < 7) {
		r = initKeyX();
		if (r != FR_OK)
			warn(L"Failed to load key X for slot 0x25\n"
				"  Code: %d\n"
				"  If your firmware version is less\n"
				"  than 7.X, some titles decryption\n"
				"  will fail, and some EmuNANDs\n"
				"  will not boot.\n", r);
	}

	if (warned) {
		warn(strings[STR_PRESS_BUTTON_ACTION],
			strings[STR_BUTTON_A], strings[STR_CONTINUE]);
		WaitForButton(BUTTON_A);
	}

	OpenAnimation();
	MenuInit(&MainMenu);
	MenuShow();
	mainLoop();
}
Пример #16
0
int Initialize()
{
	char str[100];
	char strl[100];
	char strr[100];
	char tmp[256];
	wchar_t wtmp[256];
	int r;

	preloadStringsA();

	//Show error if FSInit is not successfull
	if (!FSInit()){
		DrawString(BOT_SCREEN, strings[STR_FAILED], BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK);
		return 1;
	}

	/* Set log level here for code debug/trace */
	/*
	set_loglevel(ll_info);
	log(ll_info, "Initializing rxTools...");
	*/

	//Load the font
	LoadFont();
	if (fontLoaded){
		swprintf(wtmp, sizeof(wtmp) / sizeof(wtmp[0]), strings[STR_ERROR_OPENING], fontpath);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT - FONT_HEIGHT * 2, RED, BLACK);
	}
	else{
		preloadStringsU();
	}

	//Console Stuff
	ConsoleSetXY(15, 20);
	ConsoleSetWH(BOT_SCREEN_WIDTH - 30, SCREEN_HEIGHT - 80);
	ConsoleSetBorderColor(BLUE);
	ConsoleSetTextColor(RGB(0, 141, 197));
	ConsoleSetBackgroundColor(TRANSPARENT);
	ConsoleSetSpecialColor(BLUE);
	ConsoleSetSpacing(2);
	ConsoleSetBorderWidth(3);
	//Check that the data is installed
	f_mkdir("rxTools");
	f_mkdir("rxTools/nand");
	InstallConfigData();
	readCfg();

	//Load strings
	if (fontLoaded)
		cfgs[CFG_LANG].val.s = cfgLang;
	r = loadStrings();
	if (r) {
		sprintf(tmp, "%s/%s", langPath, cfgs[CFG_LANG].val.s);
		swprintf(wtmp, sizeof(wtmp) / sizeof(wtmp[0]), strings[STR_ERROR_OPENING], tmp);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT - FONT_HEIGHT * 3, RED, BLACK);
	}

	//Draw the top screen splash
	sprintf(str, "/rxTools/Theme/%u/TOP.bin", cfgs[CFG_THEME].val.i);
	sprintf(strl, "/rxTools/Theme/%u/TOPL.bin", cfgs[CFG_THEME].val.i);
	sprintf(strr, "/rxTools/Theme/%u/TOPR.bin", cfgs[CFG_THEME].val.i);
	if (cfgs[CFG_3D].val.i)
		DrawTopSplash(str, strl, strr);
	else
		DrawTopSplash(str, str, str);

	//If the GUI is not forced, show it only if L is hold, else directly boot rxMode (sys or emu)
	if (!cfgs[CFG_GUI].val.i)
	{
		if ((~HID_STATE) & BUTTON_L1) return 0;

		if (cfgs[CFG_ABSYSN].val.i) rxMode(0);
		else rxMode(1);
	}

	return 0; //Boot rxTools menu
}