Skip to content

Commit

Permalink
Update windows stuff, update to latest camlib/libwpd
Browse files Browse the repository at this point in the history
  • Loading branch information
petabyt committed Sep 15, 2024
1 parent 2982157 commit 4ccde8f
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 130 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-include config.mak
APP_NAME=mlinstall
HOME?=/home/$(USER)
DOWNLOADS?=$(HOME)/Downloads
APP_NAME := mlinstall
#HOME ?= /home/$(USER)
#DOWNLOADS ?= $(HOME)/Downloads

CAMLIB_SRC?=camlib/src
CAMLIB_SRC ?= camlib/src

ifndef TARGET
$(warning TARGET not defined, assuming Linux)
Expand All @@ -12,10 +12,10 @@ endif

convert_target=$(patsubst %.o,%.$(TARGET).o,$1)

APP_CORE=$(addprefix src/,main.o drive.o installer.o model.o platform.o ptp.o data.o)
CAMLIB_CORE=operations.o packet.o enums.o canon_adv.o data.o enum_dump.o lib.o canon.o ml.o liveview.o bind.o generic.o no_ip.o conv.o
APP_CORE := $(addprefix src/,main.o drive.o installer.o model.o platform.o ptp.o data.o)
CAMLIB_CORE := transport.o operations.o packet.o enums.o data.o enum_dump.o lib.o canon.o liveview.o bind.o ml.o conv.o generic.o canon_adv.o no_ip.o

CFLAGS=-Wall -Wpedantic -I$(CAMLIB_SRC) -I../libui-cross/ -O2 -g
CFLAGS := -Wall -Wpedantic -I$(CAMLIB_SRC) -I../libui-cross/ -O2 -g

ifeq ($(TARGET),l)
$(info Running Linux build)
Expand Down
80 changes: 32 additions & 48 deletions assets/libui.manifest
Original file line number Diff line number Diff line change
@@ -1,53 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
<activeCodePage>UTF-8</activeCodePage>
</asmv3:windowsSettings>
</asmv3:application>
<dependency>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Your application description here.</description>
<!-- we DO need comctl6 in the static case -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<!-- If you don't have those in your app, Windows 10's GetVersionEx() -->
<!-- DELIBERATELY reports the WRONG version... which brings us to -->
<!-- tonight's spelling bee: "How do you spell 'spineless morons'?" -->
<!-- The answer: "M-I-C-R-O-S-O-F-T; 'spineless morons'!" -->
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<!--The ID below indicates app support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates app support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates app support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates app support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates app support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
66 changes: 1 addition & 65 deletions assets/win.rc
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
ID ICON "favicon2.ico"

1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904E4"
BEGIN
VALUE "CompanyName", "Daniel Cook"
VALUE "FileDescription", "Utility to help install Magic Lantern"
VALUE "FileVersion", ""
VALUE "InternalName", "mlinstall"
VALUE "LegalCopyright", "GNU General Public License v2.0"
VALUE "OriginalFilename", "mlinstall.exe"
VALUE "ProductName", "ML Install"
VALUE "ProductVersion", ""
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1252
END
END

#define UNICODE
#define _UNICODE
#define STRICT
#define STRICT_TYPED_ITEMIDS

// see https://github.com/golang/go/issues/9916#issuecomment-74812211
// TODO get rid of this
#define INITGUID

// for the manifest
#ifndef _UI_STATIC
#define ISOLATION_AWARE_ENABLED 1
#endif

// get Windows version right; right now Windows Vista
// unless otherwise stated, all values from Microsoft's sdkddkver.h
// TODO is all of this necessary? how is NTDDI_VERSION used?
// TODO platform update sp2
#define WINVER 0x0600 /* from Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
#define _WIN32_IE 0x0700
#define NTDDI_VERSION 0x06000000

// The MinGW-w64 header has an unverified IDWriteTypography definition.
// TODO I can confirm this myself, but I don't know how long it will take for them to note my adjustments... Either way, I have to confirm this myself.
// TODO change the check from _MSC_VER to a MinGW-w64-specific check
// TODO keep track of what else is guarded by this
#ifndef _MSC_VER
#define __MINGW_USE_BROKEN_INTERFACE
#endif

#include <windows.h>

// this is a UTF-8 file
#pragma code_page(65001)

// this is the Common Controls 6 manifest
// we only define it in a shared build; static builds have to include the appropriate parts of the manifest in the output executable
// LONGTERM set up the string values here
#ifndef _UI_STATIC
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "libui.manifest"
#endif
1 24 "libui.manifest"
2 changes: 1 addition & 1 deletion src/libui.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static void *app_disconnect(void *arg) {

int on_closing(uiWindow *w, void *data)
{
// TODO: close down threads
// TODO: close down threads and connection
uiQuit();
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int ptp_connect_init() {
return PTP_NO_DEVICE;
}
#else
// TODO: libWPD doesn't have this yet
// TODO: libWPD doesn't have ptpusb_device_list yet
ptp_comm_init(&ptp_runtime);

struct PtpDeviceEntry *list = ptpusb_device_list(&ptp_runtime);
Expand Down
8 changes: 4 additions & 4 deletions src/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include <camlib.h>

void ptp_verbose_log(char *fmt, ...) {
// va_list args;
// va_start(args, fmt);
// vprintf(fmt, args);
// va_end(args);
//va_list args;
//va_start(args, fmt);
//vprintf(fmt, args);
//va_end(args);
}

void ptp_panic(char *fmt, ...) {
Expand Down
5 changes: 2 additions & 3 deletions win.mak
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ win.res: assets/win.rc
$(MINGW)-windres assets/win.rc -O coff -o win.res

LIBS=-luser32 -lkernel32 -lgdi32 -lcomctl32 -luxtheme -lmsimg32 -lcomdlg32 -ld2d1 -ldwrite -lole32 -loleaut32 -loleacc
LIBS+=-lstdc++ -lgcc -static -s -lpthread -lssp
LIBS+=-lurlmon
LIBS+=-lstdc++ -lgcc -static -lpthread -lssp -lurlmon -luuid

# Remove cmd window from startup
LIBS+=-Wl,-subsystem,windows

windows: mlinstall.exe

mlinstall.exe: $(WIN_FILES) win.res win.mak $(LIBWPD_A) $(LIBUI_A)
$(CC) $(WIN_FILES) $(LIBUI_A) $(LIBWPD_A) win.res $(LIBS) -o $(APP_NAME).exe
$(CC) $(WIN_FILES) $(LIBUI_A) $(LIBWPD_A) win.res $(LIBS) -s -o $(APP_NAME).exe

mlinstall_x86_64.exe: mlinstall.exe
cp mlinstall.exe mlinstall_x86_64.exe
Expand Down

0 comments on commit 4ccde8f

Please sign in to comment.