Commit Graph

268 Commits

Author SHA1 Message Date
Sefa Eyeoglu
a24d589845
fix: ensure all resource folders exist
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-20 10:39:05 +02:00
Sefa Eyeoglu
23fc453fae
fix: comments and naming of texture pack stuff
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-20 10:26:15 +02:00
Sefa Eyeoglu
aad6f74db6
fix: tests
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-20 10:26:15 +02:00
Sefa Eyeoglu
07dcefabcb
feat: add texture pack parsing
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-20 10:26:15 +02:00
txtsd
40c68595d7
Merge pull request #1150 from flowln/fix_crash_on_game_quit 2022-09-20 09:41:59 +05:30
flow
0873b8d304
fix: prevent container detaching in ResourceFolderModel
and use const accessors whenever we can!

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-16 20:12:31 -03:00
flow
c9eb584ac8
fix: prevent deletes by shared pointer accidental creation
This fixes the launcher crashing when opening the game :iea:

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-16 20:12:30 -03:00
flow
10493bd44a
fix: move newly allocated resources to the main thread
This avoids them getting deleted when the worker thread exits, due to
thread affinity on the created thread.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-16 20:12:30 -03:00
flow
9e35230467
fix: memory leak when getting mods from the mods folder
friendly reminder to always delete your news.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-16 20:12:30 -03:00
flow
81e326571b
fix: enable demo launch only on supported instances
e.g. >= 1.3.1 instances

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-15 19:27:42 -03:00
Sefa Eyeoglu
4c7d3a103c
refactor: restructure tests
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-11 22:29:01 +02:00
flow
333dbca01e
Merge pull request #1105 from flowln/better_resource_packs
Add basic resource pack parsing and fix issues
2022-09-07 08:30:36 -03:00
Sefa Eyeoglu
b70a82c609
Merge pull request #1111 from PolyMC/revert-1067-classpath-epicness 2022-09-05 20:06:33 +02:00
Sefa Eyeoglu
8e3356f11a
Merge pull request #1034 from Scrumplex/detect-performance-features 2022-09-05 17:45:17 +02:00
Sefa Eyeoglu
1b559c7776
Revert "Move classpath definition into NewLaunch itself"
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-05 17:37:10 +02:00
flow
bedd3c50b6
fix: improve handling of unrecognized pack formats
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 15:05:23 -03:00
flow
9db27c6acc
fix: crash when adding resource packs directly in the folder
This fixes an issue in which, when adding a new resource pack externally
to PolyMC, when the resource pack view was open, would crash poly.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
42c81395b3
fix: race condition on ResourceFolderModel tests
This (hopefully) fixes the race contiditions that sometimes got
triggered in tests.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
3b13e692d2
feat: move resource pack images to QPixmapCache
This takes care of evicting entries when the cache gets too big for us,
so we can add new entries without much worries.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
0331f5a1eb
feat(tests): add tests for resource pack parsing
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
8a7e117f6b
refactor: move resource pack file parsing utilities to separate namespace
This makes it easier to use that logic in other contexts.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
9b984cedac
feat: add image from pack.png to resource packs
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
6a93688b2e
fix: filtering in regex search in resource packs
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
3ab17a97a8
fix: sorting by pack format
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
f21ae66265
feat: add basic resource pack parsing of pack.mcmeta
This parses the pack format ID and the description from the local file,
from both a ZIP and a folder, and hooks it into the model.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
050768c266
feat: add more resource pack info
Adds pack format id and description to ResourcePack, that'll be parsed
from pack.mcmeta.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
cda2bfc240
feat: allow specifying factory for resources in BasicFolderLoadTask
This allows us to hook our own resource type, that possibly has more
content than the base Resource, to it.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:20 -03:00
flow
ba3ac85356
Merge pull request #1067 from Scrumplex/classpath-epicness
Move classpath definition into NewLaunch itself
2022-08-31 18:28:29 -03:00
flow
ec29cedeb7
Merge pull request #1080 from flowln/eternal_cache
Never invalidate libraries cache entries by time elapsed
2022-08-31 18:28:07 -03:00
flow
ddf1e1ccee
fix: make FML libraries cache eternal
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-21 13:47:49 -03:00
flow
5ac4e73697
fix: make libraries cache eternal
This restores the behavior prior to PR #920.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-21 13:47:49 -03:00
flow
0b81b283bf
fix: LGTM warnings
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:49:56 -03:00
flow
e2ab2aea32
change: add enable/disable to resources
TIL that zip resource packs, when disabled, actually have the effect of
not showing up in the game at all. Since this can be useful to someone,
I moved the logic for it to the resources.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:49:54 -03:00
flow
c3ceefbafb
refactor+fix: add new tests for Resource models and fix issues
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:49:23 -03:00
flow
e7cf9932a9
refactor: simplify Mod structure
No need to keep track of pointers left and right. A single one already
gives enough headaches!

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:51 -03:00
flow
0c9d03f5df
fix(tests): add timeout on ModFolderModel's tests
If the update never ends, the signal is not emitted and we become stuck
in the event loop forever. So a very lenient timer is added to prevent
that.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:01 -03:00
flow
92aa24ae34
fix: don't give shared pointer to obj. external to the model
It causes some weird problems and adds refcounting overhead.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:00 -03:00
flow
97a74d5c1f
refactor: adapt rest of the codebase to the new resource model
In order to access the ModFolderModel from the ModFolderPage, i created
a new m_model for the correct type, shadowing the m_model of type
ResourceFolderModel. This creates two shared_ptr references to the same object,
but since they will have the same lifetime, it doesn't generate a memory
leak.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:47:58 -03:00
flow
256f8094f5
refactor: make Resource Pack model inherit from ResourceFolderModel
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:47:11 -03:00
flow
1e2f0ab308
refactor: move more tied logic to model and move logic to the resources
This moves the QSortFilterProxyModel to the resource model files,
acessible via a factory method, and moves the sorting and filtering to
the objects themselves, decoupling the code a bit.

This also adds a basic implementation of methods in the
ResourceFolderModel, simplifying the process of constructing a new model
from it.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:47:08 -03:00
flow
af2cf2734d
refactor: move things around in the mod model
Makes the method order in the cpp file the same as in the header file.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:46:33 -03:00
flow
ec62d8e973
refactor: move general code from mod model to its own model
This aims to continue decoupling other types of resources (e.g. resource
packs, shader packs, etc) from mods, so that we don't have to
continuously watch our backs for changes to one of them affecting the
others.

To do so, this creates a more general list model for resources, based on
the mods one, that allows you to extend it with functionality for other
resources.

I had to do some template and preprocessor stuff to get around the
QObject limitation of not allowing templated classes, so that's sadge :c

On the other hand, I tried cleaning up most general-purpose code in the
mod model, and added some documentation, because it looks nice :D

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:45:01 -03:00
flow
3225f514f6
refactor: move general info from Mod to Resource
This allows us to create other resources that are not Mods, but can
still share a significant portion of code.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:41:59 -03:00
Sefa Eyeoglu
92d7e44525
Merge pull request #878 from flowln/lazy_settings 2022-08-20 12:50:56 +02:00
Sefa Eyeoglu
a517f442ea
Merge pull request #1023 from flowln/better_shared_ptr 2022-08-20 12:50:50 +02:00
Sefa Eyeoglu
01505910f4
refactor: move classpath definition into NewLaunch itself
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-18 18:14:01 +02:00
flow
2f5e55bea0
fix: only remove orphaned metadata on first opening
This avoids deleting the metadata while one is updating their mods.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-11 13:11:56 -03:00
Sefa Eyeoglu
d82bb29919
fix: don't apply GameMode/MangoHud, if they aren't supported
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-08 21:19:46 +02:00
Sefa Eyeoglu
33af0c6a7c
refactor: don't include mangohud's library path
This could cause issues on some environments. Users should just put
MangoHud libs into global LD_LIBRARY_PATH, just like with any other
library

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-08 21:16:37 +02:00
flow
362ecdb583
refactor+fix: use QSharedPointer for shared_qobject_ptr
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-04 15:33:51 -03:00