Skip to content

Commit

Permalink
Merge branch 'main' into dissasm_view
Browse files Browse the repository at this point in the history
# Conflicts:
#	GViewCore/src/View/DissasmViewer/DissasmX86.cpp
  • Loading branch information
rzaharia committed Aug 1, 2023
2 parents 761db27 + e9a43c5 commit fccd0fa
Show file tree
Hide file tree
Showing 72 changed files with 1,601 additions and 563 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# temporarily install pkg-config via brew
- name: Install pkg-config
run: |
brew update
# brew update
brew install pkg-config
brew upgrade
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
build
bin
*.log
.idea/
CMakeFiles/
cmake-build-*/
vcpkg_installed/
.DS_Store
12 changes: 12 additions & 0 deletions 3rdPartyLibs/LLVMDemangle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,16 @@ add_library(LLVMDemangle STATIC
target_include_directories(LLVMDemangle PUBLIC include/)
if (NOT MSVC)
target_compile_options(LLVMDemangle PRIVATE -Wno-deprecated-declarations)

if (APPLE)
if (CMAKE_GENERATOR STREQUAL "Xcode")
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}")
endif()
endif()
endif()
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ add_subdirectory(AppCUI)
add_subdirectory(GViewCore)
add_subdirectory(GView)

if (APPLE)
if (CMAKE_GENERATOR STREQUAL "Xcode")
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}")
endif()
endif()

# Types supported by GView
add_subdirectory(Types/PE)
add_subdirectory(Types/ICO)
Expand Down
12 changes: 12 additions & 0 deletions GView/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@ file(GLOB_RECURSE GVIEW include/*.hpp)
target_sources(GView PRIVATE ${GVIEW_HEADERS})
get_target_property(GVIEW_SOURCES GView SOURCES)
source_group(TREE ${CMAKE_SOURCE_DIR}/GView FILES ${GVIEW_SOURCES} ${GVIEW_HEADERS})

if (APPLE)
if (CMAKE_GENERATOR STREQUAL "Xcode")
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}")
endif()
endif()
12 changes: 12 additions & 0 deletions GViewCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,15 @@ file(GLOB_RECURSE GVIEWCORE_HEADERS include/*.hpp)
target_sources(GViewCore PRIVATE ${GVIEWCORE_HEADERS})
get_target_property(GVIEWCORE_SOURCES GViewCore SOURCES)
source_group(TREE ${CMAKE_SOURCE_DIR}/GViewCore FILES ${GVIEWCORE_SOURCES} ${GVIEWCORE_HEADERS})

if (APPLE)
if (CMAKE_GENERATOR STREQUAL "Xcode")
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}")
endif()
endif()
58 changes: 33 additions & 25 deletions GViewCore/include/GView.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

// Version MUST be in the following format <Major>.<Minor>.<Patch>
#define GVIEW_VERSION "0.283.0"
#define GVIEW_VERSION "0.297.0"

#include <AppCUI/include/AppCUI.hpp>

Expand Down Expand Up @@ -31,7 +31,7 @@ namespace GView
class CORE_EXPORT Object;
struct CORE_EXPORT TypeInterface
{
Object* obj;
Object* obj{ nullptr };

virtual std::string_view GetTypeName() = 0;
virtual void RunCommand(std::string_view commandName) = 0;
Expand All @@ -45,7 +45,7 @@ struct CORE_EXPORT TypeInterface
{
return 0;
}
virtual SelectionZone GetSelectionZone(uint32 index)
virtual SelectionZone GetSelectionZone(uint32)
{
return { 0, 0 };
}
Expand Down Expand Up @@ -302,7 +302,7 @@ namespace Hashes

private:
void* handle;
uint8 hash[64];
uint8 hash[64]{ 0 };
uint32 size;

private:
Expand Down Expand Up @@ -355,37 +355,37 @@ namespace DigitalSignature
String issuer;
String subject;
int32 verify;
String errorVerify;
String errorVerify{};

int32 signerVerify; // compares the certificate cert against the signer identifier si
String errorSignerVerify;
int32 signerVerify{ 0 }; // compares the certificate cert against the signer identifier si
String errorSignerVerify{};
};

constexpr auto ERR_SIGNER = -1;
constexpr auto MAX_SIZE_IN_CONTAINER = 32U;

struct CORE_EXPORT SignerAttributes
{
String name;
ASN1TYPE types[MAX_SIZE_IN_CONTAINER]; // usually one value unless (attribute.contentType == "1.2.840.113635.100.9.2") //
// V_ASN1_SEQUENCE
String contentType;
String contentTypeData;
int32 count;
String name{};
ASN1TYPE types[MAX_SIZE_IN_CONTAINER]{}; // usually one value unless (attribute.contentType == "1.2.840.113635.100.9.2") //
// V_ASN1_SEQUENCE
String contentType{};
String contentTypeData{};
int32 count{ 0 };

String CDHashes[MAX_SIZE_IN_CONTAINER]; // optional -> (attribute.contentType == "1.2.840.113635.100.9.2") // V_ASN1_SEQUENCE
};

struct CORE_EXPORT Signer
{
int32 count;
SignerAttributes attributes[MAX_SIZE_IN_CONTAINER];
uint32 attributesCount;
int32 count{ 0 };
SignerAttributes attributes[MAX_SIZE_IN_CONTAINER]{};
uint32 attributesCount{ 0 };
};

struct CORE_EXPORT SignatureMachO
{
int32 isDetached;
int32 isDetached{ 0 };
String sn;
Buffer snContent;

Expand Down Expand Up @@ -565,7 +565,7 @@ namespace Golang
struct CORE_EXPORT Function
{
char* name{ nullptr };
Func64 func;
Func64 func{};
union FstEntry
{
FstEntry32* _32;
Expand Down Expand Up @@ -818,6 +818,8 @@ namespace View
constexpr int32 VIEW_COMMAND_DEACTIVATE_COMPARE{ 0xBF11 };
constexpr int32 VIEW_COMMAND_ACTIVATE_SYNC{ 0xBF12 };
constexpr int32 VIEW_COMMAND_DEACTIVATE_SYNC{ 0xBF13 };
constexpr int32 VIEW_COMMAND_ACTIVATE_CODE_EXECUTION{ 0xBF14 };
constexpr int32 VIEW_COMMAND_DEACTIVATE_CODE_EXECUTION{ 0xBF15 };

struct ViewData
{
Expand Down Expand Up @@ -1429,11 +1431,11 @@ namespace View
Utf32Z
};

enum class MemoryMappingType
{
FunctionMapping,
TextMapping
};
enum class MemoryMappingType
{
FunctionMapping,
TextMapping
};

constexpr TypeID TypeIDError = static_cast<TypeID>(-1);

Expand Down Expand Up @@ -1532,7 +1534,13 @@ namespace App
bool CORE_EXPORT ResetConfiguration();
void CORE_EXPORT OpenFile(const std::filesystem::path& path, OpenMethod method, std::string_view typeName = "", Reference<Window> parent = nullptr);
void CORE_EXPORT OpenFile(const std::filesystem::path& path, std::string_view typeName, Reference<Window> parent = nullptr);
void CORE_EXPORT OpenBuffer(BufferView buf, const ConstString& name, const ConstString& path, OpenMethod method, std::string_view typeName = "", Reference<Window> parent = nullptr);
void CORE_EXPORT OpenBuffer(
BufferView buf,
const ConstString& name,
const ConstString& path,
OpenMethod method,
std::string_view typeName = "",
Reference<Window> parent = nullptr);
Reference<GView::Object> CORE_EXPORT GetObject(uint32 index);
uint32 CORE_EXPORT GetObjectsCount();
std::string_view CORE_EXPORT GetTypePluginName(uint32 index);
Expand All @@ -1546,4 +1554,4 @@ ADD_FLAG_OPERATORS(GView::View::LexicalViewer::StringFormat, AppCUI::uint32);
ADD_FLAG_OPERATORS(GView::View::LexicalViewer::NumberFormat, AppCUI::uint32);
ADD_FLAG_OPERATORS(GView::View::LexicalViewer::TokenAlignament, AppCUI::uint32);
ADD_FLAG_OPERATORS(GView::View::LexicalViewer::BlockFlags, AppCUI::uint16);
ADD_FLAG_OPERATORS(GView::View::LexicalViewer::TokenFlags, AppCUI::uint8);
ADD_FLAG_OPERATORS(GView::View::LexicalViewer::TokenFlags, AppCUI::uint8);
6 changes: 3 additions & 3 deletions GViewCore/src/App/FileWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace GView::App;
using namespace GView::View;
using namespace AppCUI::Input;

constexpr int HORIZONTA_PANEL_ID = 100000;
// constexpr int HORIZONTA_PANEL_ID = 100000;
constexpr int CMD_SHOW_VIEW_CONFIG_PANEL = 2000000;
constexpr int CMD_SHOW_HORIZONTAL_PANEL = 2001000;
constexpr int CMD_NEXT_VIEW = 30012345;
Expand All @@ -37,7 +37,7 @@ class CursorInformation : public UserControl
};

FileWindow::FileWindow(std::unique_ptr<GView::Object> _obj, Reference<GView::App::Instance> _gviewApp, Reference<Type::Plugin> _typePlugin)
: Window("", "d:c", WindowFlags::Sizeable), gviewApp(_gviewApp), obj(std::move(_obj)), typePlugin(_typePlugin)
: Window("", "d:c", WindowFlags::Sizeable), gviewApp(_gviewApp), typePlugin(_typePlugin), obj(std::move(_obj))
{
cursorInfoHandle = ItemHandle{};
// create splitters
Expand Down Expand Up @@ -256,7 +256,7 @@ bool FileWindow::OnEvent(Reference<Control> ctrl, Event eventType, int ID)
}
if (((ID >= CMD_FOR_TYPE_PLUGIN_START) && (ID <= CMD_FOR_TYPE_PLUGIN_START + 1000)) && (this->typePlugin.IsValid()))
{
this->obj->GetContentType()->RunCommand(this->typePlugin->GetCommands()[ID - CMD_FOR_TYPE_PLUGIN_START].name);
this->obj->GetContentType()->RunCommand(this->typePlugin->GetCommands()[static_cast<size_t>(ID) - CMD_FOR_TYPE_PLUGIN_START].name);
return true;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions GViewCore/src/App/FileWindowProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FileWindowProperties::FileWindowProperties(Reference<Tab> viewContainer) : Windo
{
auto t = Factory::Tab::Create(this, "l:1,t:1,r:1,b:3", TabFlags::LeftTabs | TabFlags::TabsBar);

auto tp1 = Factory::TabPage::Create(t, "General");
Factory::TabPage::Create(t, "General");

// process all view modes
for (uint32 idx = 0; idx < viewContainer->GetChildrenCount(); idx++)
Expand Down Expand Up @@ -45,4 +45,4 @@ bool FileWindowProperties::OnEvent(Reference<Control> control, Event eventType,
}
}
return false;
}
}
3 changes: 2 additions & 1 deletion GViewCore/src/App/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ Reference<GView::Type::Plugin> Instance::IdentifyTypePlugin(
// Get extension as UTF-16 and convert it to UTF-8
auto u16Extension = pos != u16string_view::npos ? (temp.ToStringView().substr(pos)) : std::u16string_view();
std::string extensionAsString = { u16Extension.begin(), u16Extension.end() };
std::string_view extension(extensionAsString);
std::string_view extension(extensionAsString.c_str(), extensionAsString.size());


switch (method)
{
Expand Down
Loading

0 comments on commit fccd0fa

Please sign in to comment.