;this handles the startup window XIncludeFile "NewGame.pb" XIncludeFile "inifile.pb" XIncludeFile "MatchWin.pb" XIncludeFile "PrepHost.pb" XIncludeFile "Search.pb" Procedure GetGameList() ClearGadgetItemList(#GameList) IniFile=MainPath+"MasterLst.ini" MG.l=GetInt("GameList","Total",0) If MG>0 For n=1 To MG msg.s=PeekS(GetString("GameList","G"+Trim(Str(n)),"")) If Len(msg)>1 AddGadgetItem(#GameList,-1,msg) EndIf Next n EndIf EndProcedure Procedure.l HandleSetupEvent(GID.l) reply.l=0 p.l=-1 Select GID Case #Host_Game p=GetGadgetState(#GameList) If p>=0 NewGameINI=GetGadgetItemText(#GameList,p,0) IniFile=MainPath+"Masterlst.ini" msg.s=PeekS(GetString(NewGameIni,"Path","")) If Len(msg)<5 MessageRequester("Game Setup Error","Invalid path >"+NewGameIni,#MB_ICONSTOP) Else PrepHost() EndIf Else MessageRequester("Game Setup Error","No game name selected",#MB_ICONINFORMATION) EndIf Case #Search Search_Game() Case #Del_Game p.l=GetGadgetState(#Gamelist) CallDebugger If p>=0 ;scan for this game.... IniFile=MainPath+"MasterLst.ini" mg.l=GetInt("GameList","Total",0) Debug mg For n=1 To mg msg.s=PeekS(GetString("GameList","G"+Trim(Str(n)),"")) If msg=GetGadgetItemText(#GameList,p,0) ;remove key WriteIniString("GameList","G"+Trim(Str(n)),"") WriteIniString(msg,"Path","") ;remove game section WriteIniString(msg,"","") EndIf Next n EndIf GetGameList() Case #New_Game NewGameSetup() ;msg.s=GetFilePart(NewGameIni) ;scan for a place to insert IniFile=MainPath+"MasterLst.ini" mg.l=GetInt("GameList","Total",0) For n=1 To mg msg.s=PeekS(GetString("GameList","G"+Trim(Str(n)),"")) If Len(msg)<2 ;insert here msg.s=GetFilePart(NewGameIni) WriteIniString("GameList","G"+Trim(Str(n)),msg) WriteIniString(msg,"Path",NewGameIni) n=mg reply=1 EndIf Next n If reply reply=0 Else ;add to the list WriteInt("GameList","total",n) msg.s=GetFilePart(NewGameIni) writeIniString("GameList","G"+Trim(Str(n)),msg) WriteIniString(msg,"Path",NewGameIni) EndIf GetGameList() Case #SU_About MessageRequester("Norm's MatchMaker","Main startup created 31sept2003 by Norm Perry",#MB_ICONINFORMATION) Case #SU_Exit reply=1 EndSelect ProcedureReturn reply EndProcedure Procedure ShowStartUp() Open_Window_Startup() ;SetForground() GetCurrentpath() GetGameList() quit.l=0 Repeat SetForground() Select WaitWindowEvent() Case #PB_EVENT_CLOSEWINDOW quit=1 Case #PB_EVENT_GADGET quit=HandleSetupEvent(EventGadgetID()) EndSelect Until quit EndProcedure ; ExecutableFormat=Windows ; EOF