From c17515fe9867f92d20a3f07993155f8ea95300f8 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Fri, 22 Jan 2021 22:37:06 +0100 Subject: [PATCH] Menu-FN: List packages in the updater that are listed in pkgname, not just any data/addon package. Also commented some entry-points. --- src/menu-fn/entry.cpp | 13 +++++++++++-- src/menu-fn/m_updates.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/menu-fn/w_modlist.cpp | 4 ++-- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/menu-fn/entry.cpp b/src/menu-fn/entry.cpp index 59fb1e61..bab341de 100644 --- a/src/menu-fn/entry.cpp +++ b/src/menu-fn/entry.cpp @@ -35,12 +35,14 @@ IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING\ OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\ =============================================================================="; +/* r_autoscale forces vid_conautoscale to be one of 4 integer values. + * this is due to vid_conautoscale 0 scaling with in floating point... which + * in turns results in skipped rows/columns and shimmering. */ var int autocvar_r_autoscale = TRUE; void Menu_AutoScale(void) { if (autocvar_r_autoscale) { - /* override for vid_conautoscales */ vector psize = getproperty(VF_SCREENPSIZE); if (psize[1] >= (480 * 4)) { cvar_set("vid_conautoscale", "4"); @@ -54,7 +56,9 @@ Menu_AutoScale(void) } } -/* for old Half-Life configs */ +/* old Half-Life configs that have a completely different gamma model would + * mess up visibility on initial launch - so we catch that and and force + * our default to fix it */ void Menu_GammaHack(void) { @@ -69,6 +73,7 @@ Menu_GammaHack(void) } } +/* called upon menu init/restart */ void m_init(void) { @@ -122,13 +127,16 @@ m_init(void) Menu_GammaHack(); } +/* called upon vid_reload, vid_restart, but not menu init/restart */ void Menu_RendererRestarted(string rendererdesc) { + print("Menu_REndereresrsatr\n"); Menu_AutoScale(); Menu_GammaHack(); } +/* called, in theory, whenever the menu gets killed */ void m_shutdown(void) { @@ -147,6 +155,7 @@ m_shutdown(void) memfree(games); } +/* called every frame, influenced by cl_idlefps */ void m_draw(vector screensize) { diff --git a/src/menu-fn/m_updates.cpp b/src/menu-fn/m_updates.cpp index 8ce78bb8..adde7bed 100644 --- a/src/menu-fn/m_updates.cpp +++ b/src/menu-fn/m_updates.cpp @@ -192,6 +192,7 @@ menu_updates_refresh(void) memfree(updates); } +#if 0 for (int i = 0; (getpackagemanagerinfo(i, GPMI_NAME)); i++) { string cat = getpackagemanagerinfo(i, GPMI_CATEGORY); if (cat == "Plugins/") { @@ -202,10 +203,22 @@ menu_updates_refresh(void) } update_count++; } +#else + /* look for the valid packages in the gameinfo pkgname */ + int pkgcount = tokenize(games[gameinfo_current].pkgname); + for (int i = 0i; i < pkgcount; i++) { + int id = game_getpackageid(argv(i)); + if (id == -1) + continue; + + update_count++; + } +#endif c = 0; updates = memalloc(sizeof(update_t) * update_count); +#if 0 for (int i = 0; (getpackagemanagerinfo(i, GPMI_NAME)); i++) { string cat = getpackagemanagerinfo(i, GPMI_CATEGORY); if (cat == "Plugins/") { @@ -230,6 +243,30 @@ menu_updates_refresh(void) c++; } +#else + for (int i = 0i; i < pkgcount; i++) { + int id = game_getpackageid(argv(i)); + + if (id == -1) + continue; + + updates[c].name = getpackagemanagerinfo(id, GPMI_NAME); + updates[c].category = getpackagemanagerinfo(id, GPMI_CATEGORY); + updates[c].title = getpackagemanagerinfo(id, GPMI_TITLE); + updates[c].version = getpackagemanagerinfo(id, GPMI_VERSION); + updates[c].description = getpackagemanagerinfo(id, GPMI_DESCRIPTION); + updates[c].license = getpackagemanagerinfo(id, GPMI_LICENSE); + updates[c].author = getpackagemanagerinfo(id, GPMI_AUTHOR); + updates[c].website = getpackagemanagerinfo(id, GPMI_WEBSITE); + updates[c].installed = getpackagemanagerinfo(id, GPMI_INSTALLED); + updates[c].size = (int)stof(getpackagemanagerinfo(id, GPMI_FILESIZE)); + updates[c].uid = id; + precache_pic(sprintf(FN_UPDATE_IMGURL, updates[c].name)); + + c++; + } +#endif + up_sbUpdates.SetMax(update_count); up_lbUpdates.SetMax(update_count); up_lbUpdates.SetSelected(0); diff --git a/src/menu-fn/w_modlist.cpp b/src/menu-fn/w_modlist.cpp index ccf6e971..2717aa65 100644 --- a/src/menu-fn/w_modlist.cpp +++ b/src/menu-fn/w_modlist.cpp @@ -55,7 +55,7 @@ CModList::Draw(void) [0,0,0], 1.0f); visible = floor(m_size[1] / 29); - visible = bound(0, visible, gameinfo_count); + visible = bound(0, visible, gameinfo_count - 1); pos = m_y; for (int i = m_scroll; i <= (visible + m_scroll); i++) { @@ -127,7 +127,7 @@ CModList::Input(float type, float x, float y, float devid) int pos[2]; visible = floor(m_size[1] / 29); - visible = bound(0, visible, gameinfo_count); + visible = bound(0, visible, gameinfo_count - 1); pos[0] = m_x; pos[1] = m_y;