Commits

izdubar  committed 7d7b2f9

* added new element type "StaticText" to display an hardcoded/static string to the screen
* added media type for HDD
* corrected indentation (damn CTRL+SHIFT+F ...)

  • Participants
  • Parent commits 58eaba6

Comments (0)

Files changed (4)

 
 		fadetbl[i] = t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
 	}
-
-	// Render single screen
-	guiShow();
 }
 
 void guiEnd() {
 		diaSetLabel(diaVMC, VMC_STATUS, _l(_STR_VMC_FILE_EXISTS));
 
 		if (size == 8)
-		diaSetInt(diaVMC, VMC_SIZE, 0);
+			diaSetInt(diaVMC, VMC_SIZE, 0);
 		else if (size == 16)
-		diaSetInt(diaVMC, VMC_SIZE, 1);
+			diaSetInt(diaVMC, VMC_SIZE, 1);
 		else if (size == 32)
-		diaSetInt(diaVMC, VMC_SIZE, 2);
+			diaSetInt(diaVMC, VMC_SIZE, 2);
 		else if (size == 64)
-		diaSetInt(diaVMC, VMC_SIZE, 3);
+			diaSetInt(diaVMC, VMC_SIZE, 3);
 		else {
 			diaSetInt(diaVMC, VMC_SIZE, 0);
 			diaSetLabel(diaVMC, VMC_STATUS, _l(_STR_VMC_FILE_ERROR));
 			diaSetInt(diaVMC, VMC_PROGRESS, vmc_status.VMC_progress);
 
 			if (vmc_status.VMC_error != 0)
-			LOG("genvmc updater: %d\n", vmc_status.VMC_error);
+				LOG("genvmc updater: %d\n", vmc_status.VMC_error);
 
 			if (vmc_status.VMC_status == 0x00) {
 				diaSetLabel(diaVMC, VMC_BUTTON_CREATE, _l(_STR_OK));
 			}
 		}
 		else
-		LOG("status result: %d\n", result);
+			LOG("status result: %d\n", result);
 	}
 
 	return 0;
 	char vmc[32];
 
 	if (strlen(VMCName))
-	strncpy(vmc, VMCName, 32);
+		strncpy(vmc, VMCName, 32);
 	else {
 		if (validate)
-		return 1; // nothing to validate if no user input
+			return 1; // nothing to validate if no user input
 
 		char* startup = support->itemGetStartup(id);
 		snprintf(vmc, 32, "%s_%d", startup, slot);
 					vmc_operation = OPERATION_CREATING;
 				}
 				else
-				break;
+					break;
 			}
 			else if (vmc_operation == OPERATION_ENDING) {
 				if (validate)
-				break; // directly close VMC config dialog
+					break; // directly close VMC config dialog
 
 				vmc_operation = OPERATION_END;
 			}
 		result = diaExecuteDialog(diaVMC, result, 1, &guiVMCUpdater);
 
 		if ((result == 0) && (vmc_operation == OPERATION_CREATE))
-		break;
-	}while (1);
+			break;
+	} while (1);
 
 	return result;
 }
 	submenu_list_t* result = NULL;
 
 	switch (item->type) {
-	case GUI_INIT_DONE:
-		gInitComplete = 1;
-		break;
+		case GUI_INIT_DONE:
+			gInitComplete = 1;
+			break;
 
-	case GUI_OP_ADD_MENU:
-		menuAppendItem(item->menu.menu);
-		break;
+		case GUI_OP_ADD_MENU:
+			menuAppendItem(item->menu.menu);
+			break;
 
-	case GUI_OP_APPEND_MENU:
-		result = submenuAppendItem(item->menu.subMenu, item->submenu.icon_id,
-				item->submenu.text, item->submenu.id, item->submenu.text_id);
+		case GUI_OP_APPEND_MENU:
+			result = submenuAppendItem(item->menu.subMenu, item->submenu.icon_id,
+					item->submenu.text, item->submenu.id, item->submenu.text_id);
 
-		if (!item->menu.menu->submenu)
+			if (!item->menu.menu->submenu)
+				item->menu.menu->submenu = *item->menu.subMenu;
+
+			if (item->submenu.selected)
+				item->menu.menu->current = result;
+
+			break;
+
+		case GUI_OP_SELECT_MENU:
+			menuSetSelectedItem(item->menu.menu);
+			screenHandler = &screenHandlers[GUI_SCREEN_MAIN];
+			break;
+
+		case GUI_OP_CLEAR_SUBMENU:
+			submenuDestroy(item->menu.subMenu);
+			item->menu.menu->submenu = NULL;
+			item->menu.menu->current = NULL;
+			item->menu.menu->pagestart = NULL;
+			break;
+
+		case GUI_OP_SORT:
+			submenuSort(item->menu.subMenu);
+			item->menu.menu->pagestart = NULL;
 			item->menu.menu->submenu = *item->menu.subMenu;
+			break;
 
-		if (item->submenu.selected)
-			item->menu.menu->current = result;
+		case GUI_OP_ADD_HINT:
+			// append the hint list in the menu item
+			menuAddHint(item->menu.menu, item->hint.text_id, item->hint.icon_id);
+			break;
 
-		break;
-
-	case GUI_OP_SELECT_MENU:
-		menuSetSelectedItem(item->menu.menu);
-		screenHandler = &screenHandlers[GUI_SCREEN_MAIN];
-		break;
-
-	case GUI_OP_CLEAR_SUBMENU:
-		submenuDestroy(item->menu.subMenu);
-		item->menu.menu->submenu = NULL;
-		item->menu.menu->current = NULL;
-		item->menu.menu->pagestart = NULL;
-		break;
-
-	case GUI_OP_SORT:
-		submenuSort(item->menu.subMenu);
-		item->menu.menu->pagestart = NULL;
-		item->menu.menu->submenu = *item->menu.subMenu;
-		break;
-
-	case GUI_OP_ADD_HINT:
-		// append the hint list in the menu item
-		menuAddHint(item->menu.menu, item->hint.text_id, item->hint.icon_id);
-		break;
-
-	default:
-		LOG("GUI: ??? (%d)\n", item->type);
+		default:
+			LOG("GUI: ??? (%d)\n", item->type);
 	}
 }
 
 // The same as mix, but with 8 (2*4) values mixed at once
 static void VU0MixVec(VU_VECTOR *a, VU_VECTOR *b, float mix, VU_VECTOR* res) {
 	asm (
-			"lqc2	vf1, 0(%0)\n" // load the first vector
-			"lqc2	vf2, 0(%1)\n" // load the second vector
-			"lw	$2, 0(%2)\n" // load value from ptr to reg
-			"qmtc2	$2, vf3\n" // load the mix value from reg to VU
-			"vaddw.x vf5, vf00, vf00\n" // vf5.x = 1
-			"vsub.x vf4x, vf5x, vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x
-			"vmulax.xyzw ACC, vf1, vf3x\n" // multiply vf1 by vf3.x, store the result in ACC
-			"vmaddx.xyzw vf1, vf2, vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1
-			"sqc2	vf1, 0(%3)\n" // transfer the result in acc to the ee
-			: : "r" (a), "r" (b), "r" (&mix), "r" (res)
+		"lqc2	vf1, 0(%0)\n" // load the first vector
+		"lqc2	vf2, 0(%1)\n" // load the second vector
+		"lw	$2, 0(%2)\n" // load value from ptr to reg
+		"qmtc2	$2, vf3\n" // load the mix value from reg to VU
+		"vaddw.x vf5, vf00, vf00\n" // vf5.x = 1
+		"vsub.x vf4x, vf5x, vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x
+		"vmulax.xyzw ACC, vf1, vf3x\n" // multiply vf1 by vf3.x, store the result in ACC
+		"vmaddx.xyzw vf1, vf2, vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1
+		"sqc2	vf1, 0(%3)\n" // transfer the result in acc to the ee
+		: : "r" (a), "r" (b), "r" (&mix), "r" (res)
 	);
 }
 
 	} else {
 		if (bfadeout < 0x080)
 			bfadeout += 0x20;
-		else
-			bfadeout += 0x0;
 	}
 
 	// is init still running?
 }
 
 struct gui_update_t *guiOpCreate(gui_op_type_t type) {
-	struct gui_update_t *op = (struct gui_update_t *) malloc(
-			sizeof(struct gui_update_t));
+	struct gui_update_t *op = (struct gui_update_t *) malloc(sizeof(struct gui_update_t));
 	memset(op, 0, sizeof(struct gui_update_t));
 	op->type = type;
 	return op;
 		rmDrawLine(50, 75, screenWidth - 50, 75, gColWhite);
 		rmDrawLine(50, 410, screenWidth - 50, 410, gColWhite);
 
-		fntRenderString(FNT_DEFAULT, screenWidth >> 1, gTheme->usedHeight >> 1,
-				ALIGN_CENTER, text, gTheme->textColor);
-		fntRenderString(FNT_DEFAULT, 500, 417, ALIGN_NONE, _l(_STR_O_BACK),
-				gTheme->selTextColor);
+		fntRenderString(FNT_DEFAULT, screenWidth >> 1, gTheme->usedHeight >> 1, ALIGN_CENTER, text, gTheme->textColor);
+		fntRenderString(FNT_DEFAULT, 500, 417, ALIGN_NONE, _l(_STR_O_BACK), gTheme->selTextColor);
 		if (addAccept)
-			fntRenderString(FNT_DEFAULT, 70, 417, ALIGN_NONE,
-					_l(_STR_X_ACCEPT), gTheme->selTextColor);
+			fntRenderString(FNT_DEFAULT, 70, 417, ALIGN_NONE, _l(_STR_X_ACCEPT), gTheme->selTextColor);
 
 		guiEndFrame();
 	}
 	return terminate - 1;
 }
 
-void guiHandleDefferedIO(int *ptr, const unsigned char* message, int type,
-		void *data) {
+void guiHandleDefferedIO(int *ptr, const unsigned char* message, int type, void *data) {
 	ioPutRequest(type, data);
 
 	while (*ptr) {
 
 		rmDrawRect(0, 0, ALIGN_NONE, DIM_INF, DIM_INF, gColDarker);
 
-		fntRenderString(FNT_DEFAULT, screenWidth >> 1, gTheme->usedHeight >> 1,
-				ALIGN_CENTER, message, gTheme->textColor);
+		fntRenderString(FNT_DEFAULT, screenWidth >> 1, gTheme->usedHeight >> 1, ALIGN_CENTER, message, gTheme->textColor);
 
 		// so the io status icon will be rendered
 		guiDrawOverlays();
 
 	rmDrawRect(0, 0, ALIGN_NONE, DIM_INF, DIM_INF, gColDarker);
 
-	fntRenderString(FNT_DEFAULT, screenWidth >> 1, gTheme->usedHeight >> 1,
-			ALIGN_CENTER, message, gTheme->textColor);
+	fntRenderString(FNT_DEFAULT, screenWidth >> 1, gTheme->usedHeight >> 1, ALIGN_CENTER, message, gTheme->textColor);
 
 	// so the io status icon will be rendered
 	guiDrawOverlays();

File src/hddsupport.c

 	config_set_t* config = configAlloc(0, NULL, NULL);
 	hdl_game_info_t* game = &hddGames->games[id];
 	configSetStr(config, "#Format", "HDL");
-	/*if (game->disctype == 0x12)
+	if (game->disctype == 0x12)
 		configSetStr(config, "#Media", "CD");
 	else
-		configSetStr(config, "#Media", "DVD");*/ // TODO must ask Jimmi/Polo about the HDL header format
+		configSetStr(config, "#Media", "DVD");
 	configSetStr(config, "#Name", game->name);
 	configSetStr(config, "#Startup", game->startup);
 	configSetInt(config, "#Size", game->total_size_in_kb / 1024);

File src/menusys.c

 		// render, advance
 		// TODO: Theme support for main menu (font)
 		fntRenderString(FNT_DEFAULT, 320, y, ALIGN_CENTER, submenuItemGetText(&it->item), (cp == sitem) ? gTheme->selTextColor : gTheme->textColor);
-
 		y += spacing;
 	}
 }
 	} else if(getKey(KEY_DOWN)){
 		menuNextV();
 	} else if(getKeyOn(KEY_CROSS)) {
-		if (gUseInfoScreen && selected_item->item->current && gTheme->infoElems.first) {
+		if (selected_item->item->current && gUseInfoScreen && gTheme->infoElems.first) {
 			if (selected_item->item->current->item.id != itemIdConfig) {
 				itemIdConfig = selected_item->item->current->item.id;
 

File src/themes.c

 static char **guiThemesNames = NULL;
 
 #define TYPE_ATTRIBUTE_TEXT		0
-#define TYPE_ATTRIBUTE_IMAGE	1
-#define TYPE_GAME_IMAGE			2
-#define TYPE_STATIC_IMAGE		3
-#define TYPE_BACKGROUND			4
-#define TYPE_MENU_ICON			5
-#define TYPE_MENU_TEXT			6
-#define	 TYPE_ITEMS_LIST		7
-#define	 TYPE_ITEM_ICON			8
-#define	 TYPE_ITEM_COVER		9
-#define TYPE_ITEM_TEXT			10
-#define TYPE_HINT_TEXT			11
-#define TYPE_LOADING_ICON		12
+#define TYPE_STATIC_TEXT		1
+#define TYPE_ATTRIBUTE_IMAGE	2
+#define TYPE_GAME_IMAGE			3
+#define TYPE_STATIC_IMAGE		4
+#define TYPE_BACKGROUND			5
+#define TYPE_MENU_ICON			6
+#define TYPE_MENU_TEXT			7
+#define	 TYPE_ITEMS_LIST		8
+#define	 TYPE_ITEM_ICON			9
+#define	 TYPE_ITEM_COVER		10
+#define TYPE_ITEM_TEXT			11
+#define TYPE_HINT_TEXT			12
+#define TYPE_LOADING_ICON		13
 
 static char *elementsType[] = {
 	"AttributeText",
+	"StaticText",
 	"AttributeImage",
 	"GameImage",
 	"StaticImage",
 	"LoadingIcon",
 };
 
+// StaticText ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void drawStaticText(struct menu_list* menu, struct submenu_list* item, config_set_t* config, struct theme_element* elem) {
+	fntRenderString(elem->font, elem->posX, elem->posY, elem->aligned, (char *) elem->extended, elem->color);
+}
+
+static void initStaticText(char* themePath, config_set_t* themeConfig, theme_t* theme, theme_element_t* elem, char* name,
+		char* value) {
+
+	char elemProp[64];
+
+	snprintf(elemProp, 64, "%s_value", name);
+	configGetStr(themeConfig, elemProp, &value);
+	if (value) {
+		int length = strlen(value) + 1;
+		elem->extended = (char*) malloc(length * sizeof(char));
+		memcpy(elem->extended, value, length);
+		// elem->endElem = &endBasic; does the job
+
+		elem->drawElem = &drawStaticText;
+	} else
+		LOG("elemStaticText %s: NO value, elem disabled !!\n", name);
+}
+
 // AttributeText ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 static void drawAttributeText(struct menu_list* menu, struct submenu_list* item, config_set_t* config, struct theme_element* elem) {
 			if (!strcmp(elementsType[TYPE_ATTRIBUTE_TEXT], type)) {
 				elem = initBasic(themePath, themeConfig, theme, screenWidth, screenHeight, name, TYPE_ATTRIBUTE_TEXT, 0, 0, ALIGN_CENTER, DIM_UNDEF, DIM_UNDEF, gDefaultCol, FNT_DEFAULT);
 				initAttributeText(themePath, themeConfig, theme, elem, name, NULL);
+			} else if (!strcmp(elementsType[TYPE_STATIC_TEXT], type)) {
+				elem = initBasic(themePath, themeConfig, theme, screenWidth, screenHeight, name, TYPE_STATIC_TEXT, 0, 0, ALIGN_CENTER, DIM_UNDEF, DIM_UNDEF, gDefaultCol, FNT_DEFAULT);
+				initStaticText(themePath, themeConfig, theme, elem, name, NULL);
 			} else if (!strcmp(elementsType[TYPE_ATTRIBUTE_IMAGE], type)) {
 				elem = initBasic(themePath, themeConfig, theme, screenWidth, screenHeight, name, TYPE_ATTRIBUTE_IMAGE, 0, 0, ALIGN_CENTER, DIM_UNDEF, DIM_UNDEF, gDefaultCol, FNT_DEFAULT);
 				initAttributeImage(themePath, themeConfig, theme, elem, name);