Skip to content

Commit

Permalink
Merge pull request #40 from Futuremappermydud/master
Browse files Browse the repository at this point in the history
1.36.1 Update.
  • Loading branch information
NSGolova authored Apr 16, 2024
2 parents 91b865d + 870eebc commit cca8d4a
Show file tree
Hide file tree
Showing 93 changed files with 2,082 additions and 1,411 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}
./QPM/qpm qmod build
pwsh -Command ./build.ps1
pwsh -Command ./scripts/build.ps1
- name: Create Qmod
run: |
pwsh -Command ./buildQMOD.ps1 ${{env.qmodName}}
pwsh -Command ./scripts/createqmod.ps1 ${{env.qmodName}}
- name: Get Library Name
id: libname
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ ndkpath.txt
*.log
log.txt
cmake-build-debug/
.cache
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ project(${COMPILE_ID})
# c++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# define that stores the actual source directory
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
Expand All @@ -27,7 +28,6 @@ add_compile_options(-frtti -fexceptions)
add_compile_options(-O3)
# compile definitions used
add_compile_definitions(VERSION=\"${MOD_VERSION}\")
add_compile_definitions(ID=\"${MOD_ID}\")
add_compile_definitions(MOD_ID=\"${MOD_ID}\")
add_compile_definitions(USE_CODEGEN_FIELDS)

Expand Down
36 changes: 0 additions & 36 deletions build.ps1

This file was deleted.

79 changes: 0 additions & 79 deletions buildQMOD.ps1

This file was deleted.

59 changes: 0 additions & 59 deletions copy.ps1

This file was deleted.

32 changes: 13 additions & 19 deletions include/Assets/Gif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ struct Gif

if (frame->RasterBits[loc] == ext->Bytes[3] && ext->Bytes[0])
{
pixelData[locWithinFrame] = Color32(0xff, 0xff, 0xff, 0);
pixelData[locWithinFrame] = Color32(0, 0xff, 0xff, 0xff, 0);
} else {
color = &colorMap->Colors[frame->RasterBits[loc]];
pixelData[locWithinFrame] = Color32(color->Red, color->Green, color->Blue, 0xff);
pixelData[locWithinFrame] = Color32(0, color->Red, color->Green, color->Blue, 0xff);
}

}
Expand Down Expand Up @@ -149,9 +149,6 @@ struct Gif
::ArrayW<UnityEngine::Texture2D*> frames = ArrayW<UnityEngine::Texture2D*>(length);
ArrayW<float> timings = ArrayW<float> (length);

// FrameBuffer
TextureColor *pixelData = new TextureColor[width * height];

// Persist data from the previous frame
GifColorType* color;
SavedImage* frame;
Expand All @@ -161,6 +158,7 @@ struct Gif
// Graphic control ext block
GraphicsControlBlock GCB;
int GCBResult = GIF_ERROR;
::ArrayW<Color32> pixelData = nullptr;

for (int idx = 0; idx < length; idx++) {
int x, y, j, loc;
Expand All @@ -184,9 +182,12 @@ struct Gif
if (ext != nullptr) {
GCBResult = DGifExtensionToGCB(ext->ByteCount, (const GifByteType*)ext->Bytes, &GCB);
}

// gif->SWidth is not neccesarily the same as FrameInfo->Width due to a frame possibly describing a smaller block of pixels than the entire gif size

UnityEngine::Texture2D* texture = UnityEngine::Texture2D::New_ctor(width, height, UnityEngine::TextureFormat::RGBA32, false);
if (!pixelData) {
pixelData = texture->GetPixels32();
}
// This is the same size as the entire size of the gif :)
// offset into the entire image, might need to also have it's y value flipped? need to test
long flippedFrameTop = height - frameInfo->Top - frameInfo->Height;
Expand All @@ -202,14 +203,12 @@ struct Gif

// Checks if the pixel is transparent
if (GCB.TransparentColor >=0 && frame->RasterBits[loc] == ext->Bytes[3] && ext->Bytes[0]) {
pixelData[locWithinFrame] = {
0xff, 0xff, 0xff, 0
};
if (GCB.DisposalMode == 2) {
pixelData[locWithinFrame] = Color32(0, 0xff, 0xff, 0xff, 0);
}
} else {
color = &colorMap->Colors[frame->RasterBits[loc]];
pixelData[locWithinFrame] = {
color->Red, color->Green, color->Blue, 0xff
};
pixelData[locWithinFrame] = Color32(0, color->Red, color->Green, color->Blue, 0xff);
}

}
Expand All @@ -219,18 +218,13 @@ struct Gif
}

// Copy raw pixel data to texture
texture->LoadRawTextureData(pixelData, width * height * 4);
// texture->set_filterMode(UnityEngine::FilterMode::Trilinear);
// Compress texture
texture->Compress(false);
texture->SetAllPixels32(pixelData, 0);
// Upload to GPU
texture->Apply();

frames[idx] = texture;
timings[idx] = static_cast<float>(GCB.DelayTime);
};
// Clear FrameBuffer to not leak things
delete[] pixelData;
return {
frames, timings
};
Expand Down Expand Up @@ -258,7 +252,7 @@ struct Gif
}

vectorwrapbuf(Array<CharT>* arr) {
this->std::basic_streambuf<CharT, TraitsT>::setg(arr->values, arr->values, arr->values + arr->Length());
this->std::basic_streambuf<CharT, TraitsT>::setg(arr->_values, arr->_values, arr->_values + arr->get_Length());
}
};

Expand Down
8 changes: 4 additions & 4 deletions include/Enhancers/MapEnhancer.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "GlobalNamespace/IDifficultyBeatmap.hpp"
#include "GlobalNamespace/IPreviewBeatmapLevel.hpp"
#include "GlobalNamespace/BeatmapKey.hpp"
#include "GlobalNamespace/BeatmapLevel.hpp"
#include "GlobalNamespace/PlayerSpecificSettings.hpp"
#include "GlobalNamespace/GameplayModifiers.hpp"
#include "GlobalNamespace/PracticeSettings.hpp"
Expand All @@ -15,8 +15,8 @@ using namespace GlobalNamespace;
class MapEnhancer
{
public:
IDifficultyBeatmap* difficultyBeatmap;
IPreviewBeatmapLevel* previewBeatmapLevel;
BeatmapKey difficultyBeatmap;
BeatmapLevel* beatmapLevel;
GameplayModifiers* gameplayModifiers;
PlayerSpecificSettings* playerSpecificSettings;
PracticeSettings* practiceSettings;
Expand Down
4 changes: 2 additions & 2 deletions include/UI/CaptorClanUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "include/Models/Clan.hpp"

#include "questui/shared/BeatSaberUI.hpp"
#include "questui/shared/QuestUI.hpp"
#include "bsml/shared/BSML-Lite.hpp"
#include "bsml/shared/BSML.hpp"

#include "TMPro/TextMeshProUGUI.hpp"

Expand Down
25 changes: 25 additions & 0 deletions include/UI/Components/ExternalComponents.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once
#include <vector>
#include "UnityEngine/MonoBehaviour.hpp"
#include "UnityEngine/Component.hpp"

#include "custom-types/shared/macros.hpp"

DECLARE_CLASS_CODEGEN(QuestUI, ExternalComponents, UnityEngine::MonoBehaviour,

private:
std::vector<UnityEngine::Component*> components;
public:
template<class T = UnityEngine::Component*>
T Get() {
return (T)GetByType(csTypeOf(T));
}

DECLARE_INSTANCE_METHOD(void, Add, UnityEngine::Component* component);
DECLARE_INSTANCE_METHOD(UnityEngine::Component*, GetByType, Il2CppReflectionType* type);

DECLARE_DEFAULT_CTOR();

DECLARE_SIMPLE_DTOR();

)
6 changes: 3 additions & 3 deletions include/UI/Components/SmoothHoverController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>
using namespace std;

#define GET_FIND_METHOD(mPtr) il2cpp_utils::il2cpp_type_check::MetadataGetter<mPtr>::get()
#define GET_FIND_METHOD(mPtr) il2cpp_utils::il2cpp_type_check::MetadataGetter<mPtr>::methodInfo()

DECLARE_CLASS_CODEGEN_INTERFACES(
BeatLeader,
Expand All @@ -34,8 +34,8 @@ DECLARE_CLASS_CODEGEN_INTERFACES(
HoverStateChangedEvent & get_hoverStateChangedEvent();
HoverStateChangedEvent hoverStateChangedEvent;

DECLARE_OVERRIDE_METHOD(void, OnPointerEnter, il2cpp_utils::il2cpp_type_check::MetadataGetter<&UnityEngine::EventSystems::IPointerEnterHandler::OnPointerEnter>::get(), UnityEngine::EventSystems::PointerEventData*);
DECLARE_OVERRIDE_METHOD(void, OnPointerExit, il2cpp_utils::il2cpp_type_check::MetadataGetter<&UnityEngine::EventSystems::IPointerExitHandler::OnPointerExit>::get(), UnityEngine::EventSystems::PointerEventData*);
DECLARE_OVERRIDE_METHOD(void, OnPointerEnter, il2cpp_utils::il2cpp_type_check::MetadataGetter<&UnityEngine::EventSystems::IPointerEnterHandler::OnPointerEnter>::methodInfo(), UnityEngine::EventSystems::PointerEventData*);
DECLARE_OVERRIDE_METHOD(void, OnPointerExit, il2cpp_utils::il2cpp_type_check::MetadataGetter<&UnityEngine::EventSystems::IPointerExitHandler::OnPointerExit>::methodInfo(), UnityEngine::EventSystems::PointerEventData*);

DECLARE_INSTANCE_METHOD(void, OnDisable);
DECLARE_INSTANCE_METHOD(void, Update);
Expand Down
Loading

0 comments on commit cca8d4a

Please sign in to comment.