Compare commits
No commits in common. "master" and "WH_GETMESSAGE" have entirely different histories.
master
...
WH_GETMESS
61 changed files with 700 additions and 3472 deletions
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
|
@ -4,6 +4,7 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'develop'
|
||||
- 'github-action'
|
||||
|
||||
jobs:
|
||||
|
@ -151,4 +152,4 @@ jobs:
|
|||
tag_name: experimental
|
||||
files: cnc-ddraw-experimental/*
|
||||
fail_on_unmatched_files: true
|
||||
draft: true
|
||||
draft: true
|
39
Makefile
39
Makefile
|
@ -1,37 +1,22 @@
|
|||
-include config.mk
|
||||
|
||||
TARGET ?= ddraw.dll
|
||||
TARGET = ddraw.dll
|
||||
LDFLAGS = -Wl,--enable-stdcall-fixup -s -static -shared
|
||||
CFLAGS = -Iinc -O2 -march=i486 -Wall
|
||||
LIBS = -lgdi32 -lwinmm -ldbghelp -lole32
|
||||
|
||||
LDFLAGS ?= -Wl,--enable-stdcall-fixup -s -static -shared
|
||||
CFLAGS ?= -Iinc -O2 -Wall -std=c99
|
||||
LIBS = -lgdi32 -lwinmm -lole32 -lmsimg32 -lavifil32 -luuid
|
||||
COMMIT := $(shell git describe --match=NeVeRmAtCh --always --dirty || echo "UNKNOWN")
|
||||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD || echo "UNKNOWN")
|
||||
ECOMMIT := $(shell echo "#define GIT_COMMIT" \"$(COMMIT)\" > inc/git.h)
|
||||
EBRANCH := $(shell echo "#define GIT_BRANCH" \"$(BRANCH)\" >> inc/git.h)
|
||||
|
||||
COMMIT := $(shell git describe --match=NeVeRmAtCh --always --dirty || echo UNKNOWN)
|
||||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD || echo UNKNOWN)
|
||||
|
||||
HASH := \#
|
||||
ECHOTEST := $(shell echo \"\")
|
||||
ifeq ($(ECHOTEST),\"\")
|
||||
# Windows
|
||||
ECOMMIT := $(shell echo $(HASH)define GIT_COMMIT "$(COMMIT)" > inc/git.h)
|
||||
EBRANCH := $(shell echo $(HASH)define GIT_BRANCH "$(BRANCH)" >> inc/git.h)
|
||||
else
|
||||
# Either *nix or Windows with BusyBox (e.g. w64devkit)
|
||||
ECOMMIT := $(shell echo "$(HASH)define GIT_COMMIT" \"$(COMMIT)\" > inc/git.h)
|
||||
EBRANCH := $(shell echo "$(HASH)define GIT_BRANCH" \"$(BRANCH)\" >> inc/git.h)
|
||||
endif
|
||||
CC = i686-w64-mingw32-gcc
|
||||
WINDRES ?= i686-w64-mingw32-windres
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS += -D _DEBUG -D _DEBUG_X
|
||||
endif
|
||||
|
||||
ifdef _WIN32_WINNT
|
||||
CFLAGS += -march=i486 -D _WIN32_WINNT=$(_WIN32_WINNT)
|
||||
endif
|
||||
|
||||
CC = i686-w64-mingw32-gcc
|
||||
WINDRES ?= i686-w64-mingw32-windres
|
||||
|
||||
SRCS := $(wildcard src/*.c) $(wildcard src/*/*.c) res.rc
|
||||
OBJS := $(addsuffix .o, $(basename $(SRCS)))
|
||||
|
||||
|
@ -39,10 +24,10 @@ OBJS := $(addsuffix .o, $(basename $(SRCS)))
|
|||
all: $(TARGET)
|
||||
|
||||
%.o: %.rc
|
||||
$(WINDRES) -J rc $< $@ || windres -J rc $< $@
|
||||
$(WINDRES) -J rc $< $@
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ exports.def $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGET) $(OBJS) || del $(TARGET) $(subst /,\\,$(OBJS))
|
||||
$(RM) $(TARGET) $(OBJS)
|
||||
|
|
183
README.md
183
README.md
|
@ -1,11 +1,11 @@
|
|||
# cnc-ddraw
|
||||
cnc-ddraw can fix compatibility issues in older 2D games, such as black screen, bad performance, crashes or defective Alt+Tab. It does also add new features such as borderless mode, windowed mode and upscaling via shaders.
|
||||
cnc-ddraw can fix compatibility issues in older 2D games, such as black screen, bad performance, crashes or defective Alt+Tab.
|
||||
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
- Supports Windows ME, 2000, XP, Vista, 7, 8, 10, 11, Wine (Linux/macOS/Android) and Virtual Machines
|
||||
- Supports Windows 2000, XP, Vista, 7, 8, 10, 11, Wine (Linux/macOS/Android) and Virtual Machines
|
||||
- GDI / OpenGL / Direct3D 9 renderer (With automatic renderer selection)
|
||||
- Upscaling via glsl shaders - https://imgur.com/a/kxsM1oY | https://imgur.com/a/wjrhpFV
|
||||
- Windowed Mode / Fullscreen Exclusive Mode / Borderless Mode
|
||||
|
@ -24,16 +24,31 @@ cnc-ddraw can fix compatibility issues in older 2D games, such as black screen,
|
|||
1. Download [cnc-ddraw.zip](https://github.com/FunkyFr3sh/cnc-ddraw/releases/latest/download/cnc-ddraw.zip) and extract it into your game folder
|
||||
2. Start the game
|
||||
|
||||
Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.winehq.org/Winecfg#Libraries) manually or run `cnc-ddraw config.exe` once.
|
||||
Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.winehq.org/Winecfg#Libraries) manually or run cnc-ddraw config.exe once.
|
||||
|
||||
|
||||
|
||||
**Important**
|
||||
If you use cnc-ddraw with a game that got its own windowed mode built in then **make sure you disable the games own windowed mode** first. You can enable windowed mode via cnc-ddraw config.exe instead.
|
||||
|
||||
- **The game must be set to fullscreen**. To enable windowed mode, use `cnc-ddraw config.exe` instead
|
||||
- **cnc-ddraw does not support Direct3D games**, the game must have a **DirectDraw (Software)** renderer
|
||||
- **If the game doesn't start at all or it's crashing**, [then please generate a debug log file and upload it.](https://github.com/FunkyFr3sh/cnc-ddraw/issues/44)
|
||||
- Some games require additional steps before they can be used with cnc-ddraw, check the [wiki](https://github.com/FunkyFr3sh/cnc-ddraw/wiki) for details
|
||||
|
||||
|
||||
**If the game starts but it doesn't work perfectly** then open the config program and check the **Compatibility settings**.
|
||||
|
||||
|
||||
|
||||
**cnc-ddraw does not support Direct3D/Glide**, it will only work with games that use a **DirectDraw (Software)** renderer. Usually you can tell by the look of the game if it's a 3D game or not, but you can also let cnc-ddraw generate a debug log and search for "IDirect3D" - Link: https://github.com/FunkyFr3sh/cnc-ddraw/issues/44
|
||||
|
||||
|
||||
|
||||
Some games may require additional steps before they can be used with cnc-ddraw, please check the [wiki](https://github.com/FunkyFr3sh/cnc-ddraw/wiki) for more details.
|
||||
|
||||
|
||||
|
||||
**If the game doesn't start at all or it's crashing**, [then please generate a debug log file and upload it.](https://github.com/FunkyFr3sh/cnc-ddraw/issues/44)
|
||||
|
||||
|
||||
|
||||
Need help and don't have a github account? Ask your questions on [Discord](https://discord.gg/afWXJNDDF5) (No registration required)
|
||||
|
||||
|
||||
|
||||
|
@ -46,9 +61,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
|
||||
|
||||
### Supported Games
|
||||
- 101: The Airborne Invasion of Normandy
|
||||
- 7th Legion
|
||||
- Abomination - The Nemesis Project
|
||||
- Addiction Pinball
|
||||
- Age of Empires
|
||||
- Age of Empires II
|
||||
|
@ -57,24 +69,14 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Age of Wonders
|
||||
- Age of Wonders 2
|
||||
- Age of Wonders: Shadow Magic
|
||||
- Agharta the Hollow Earth
|
||||
- Airline 69: Return to Casablanca
|
||||
- Airline Tycoon Deluxe
|
||||
- Alien Nations
|
||||
- American Conquest (Steam+GOG)
|
||||
- American Girls Dress Designer
|
||||
- Amerzone
|
||||
- Ancient Conquest
|
||||
- Ancient Evil
|
||||
- Anno 1602: Creation of a New World
|
||||
- Another War
|
||||
- Anstoss 3
|
||||
- Arcanum: Of Steamworks and Magick Obscura
|
||||
- Arcatera the Dark Brotherhood
|
||||
- Army Men 2
|
||||
- Army Men: Air Tactics
|
||||
- Army Men: Toys in Space
|
||||
- Army Men: World War / Army Men: Operation Meltdown
|
||||
- Arthur's Pet Chase
|
||||
- Arthur's Sand Castle Contest
|
||||
- Arthur's Wilderness Rescue
|
||||
|
@ -86,31 +88,24 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Baldr Force EXE
|
||||
- Baldur's Gate
|
||||
- Baldur's Gate 2
|
||||
- Balls of Steel v1.2
|
||||
- Barbie(R) Photo Designer
|
||||
- Barbie(tm) Beach Vacation(tm)
|
||||
- Barbie(R) Photo Designer
|
||||
- Batman: Justice Unbalanced
|
||||
- Batman: Toxic Chill
|
||||
- Bejeweled 2 Deluxe
|
||||
- Birthright: The Gorgons Alliance
|
||||
- Blade & Sword
|
||||
- Blood II - The Chosen
|
||||
- Blue's 123 Time Activities
|
||||
- Blue's Treasure Hunt
|
||||
- Broken Sword
|
||||
- Broken Sword 2: The Smoking Mirror
|
||||
- Caesar III (Sierra - 1998)
|
||||
- Call To Power 2
|
||||
- Callus 95 - CPS-1 (Capcom Play System 1) emulator
|
||||
- Call To Power 2
|
||||
- Capitalism II
|
||||
- Capitalism Lab
|
||||
- Captain Claw
|
||||
- Carmageddon
|
||||
- Carmageddon 2
|
||||
- Casino Empire (AKA Hoyle Casino)
|
||||
- Championship Manager 99-00
|
||||
- Chaos Gate
|
||||
- Clans
|
||||
- Close Combat 2: A Bridge Too Far
|
||||
- Close Combat 3: The Russian Front
|
||||
- Close Combat 4: The Battle of the Bulge
|
||||
|
@ -134,41 +129,25 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Commandos
|
||||
- Commandos - Beyond The Call Of Duty
|
||||
- Commandos 2
|
||||
- Commando 2004 (only with /ddraw command line parameter)
|
||||
- Constructor
|
||||
- Corsairs Gold
|
||||
- Cossacks (Steam+GOG)
|
||||
- Cultures - The Discovery of Vinland
|
||||
- Cultures 2
|
||||
- Cyber Gladiators (needs CyberGladiators_Patch_Win_EN_WinXP.zip)
|
||||
- Cyberchase Carnival Chaos
|
||||
- Cyberchase Castleblanca Quest
|
||||
- Cydonia Mars - The First Manned Mission
|
||||
- Cloud Kingdom 3 (only with /ddraw command line parameter)
|
||||
- Dark Earth
|
||||
- Dark Reign: The Future of War
|
||||
- Dark Secret of Africa
|
||||
- Day Of The Tentacle
|
||||
- Daytona
|
||||
- Daytona USA (Sega - 1996)
|
||||
- Deadlock 2
|
||||
- Deadly Tide
|
||||
- Delta Force
|
||||
- Desperados: Wanted Dead or Alive
|
||||
- Diablo
|
||||
- Diablo 2
|
||||
- Diablo 2: Lord of Destruction
|
||||
- Diablo: Hellfire
|
||||
- Die by the Sword
|
||||
- Disciples
|
||||
- Disciples 2 - Rise of the Elves
|
||||
- Discoworld Noir
|
||||
- Divine Divinity
|
||||
- Dominion - Storm Over Gift 3
|
||||
- Doom 95
|
||||
- Dracula
|
||||
- Dragon Throne: Battle of Red Cliffs
|
||||
- Dreams to Realty
|
||||
- DuelSavior
|
||||
- DuelSavior: Justice
|
||||
- Dune 2000
|
||||
|
@ -179,19 +158,13 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Emperor: Rise of the Middle Kingdom
|
||||
- Enemy Infestation
|
||||
- Escape Velocity Nova
|
||||
- Excalibur 2555AD
|
||||
- F-16 Agressor
|
||||
- F-16 Multirole Fighter
|
||||
- F-22 Raptor
|
||||
- Fable
|
||||
- Fairy Tale About Father Frost, Ivan and Nastya
|
||||
- Falcon 4.0 (Microprose version)
|
||||
- Fallout
|
||||
- Fallout 2
|
||||
- Fallout Tactics: Brotherhood of Steel
|
||||
- Final fantasy VII
|
||||
- Final fantasy VIII
|
||||
- Final Liberation: Warhammer Epic 40000 (GOG)
|
||||
- Freddi Fish
|
||||
- Freddi Fish 4
|
||||
- Freddi Fish's One-Stop Fun Shop
|
||||
|
@ -200,41 +173,24 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Freddi Fish: The Case of the Haunted Schoolhouse
|
||||
- Freddi Fish: The Case of the Hogfish Rustlers of Briny Gulch
|
||||
- Freddi Water Worries
|
||||
- Full Throttle
|
||||
- Future Cop L.A.P.D
|
||||
- G-Police
|
||||
- Gateway (Remake)
|
||||
- Geneforge
|
||||
- Gilbert Goodmate And The Mushroom Of Phungoria
|
||||
- Gorasul: The Legacy of the Dragon
|
||||
- Grand Theft Auto
|
||||
- Grand Theft Auto: London 1961
|
||||
- Grand Theft Auto: London 1969
|
||||
- Gromada Revenge
|
||||
- Gruntz
|
||||
- Gorasul: The Legacy of the Dragon
|
||||
- Hamtaro: Wake Up Snoozer!
|
||||
- Handkerchief
|
||||
- Hard Truck: Road to Victory
|
||||
- Heart of Darkness
|
||||
- Hearts of Iron 2
|
||||
- Heroes Chronicles: Clash of the Dragons
|
||||
- Heroes Chronicles: Conquest of the Underworld
|
||||
- Heroes Chronicles: Masters of the Elements
|
||||
- Heroes Chronicles: Warlords of the Wasteland
|
||||
- Heroes of Might and Magic
|
||||
- Heroes of Might and Magic II
|
||||
- Heroes of Might and Magic III
|
||||
- Heroes of Might and Magic IV
|
||||
- Hexen 95
|
||||
- Hooligans: Storm over Europe
|
||||
- Hugo Gold
|
||||
- Hugo Wild River
|
||||
- Icewind Dale
|
||||
- Icewind Dale 2
|
||||
- Ignition
|
||||
- Imperialism 2: The Age of Exploration
|
||||
- Indiana Jones and the Fate of Atlantis
|
||||
- Indiana Jones and the Last Crusade
|
||||
- Infantry Online
|
||||
- Interstate 76
|
||||
- Invictus: In the Shadow of Olympus
|
||||
|
@ -242,8 +198,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Jagged Alliance 2: Unfinished Business
|
||||
- Jagged Alliance 2: Wildfire
|
||||
- Jazz Jackrabbit 2
|
||||
- Jeff Wayne's The War of the Worlds
|
||||
- Karma Immortal Wrath
|
||||
- Killing Time
|
||||
- Kings Quest 8: Mask of Eternity
|
||||
- KKND Xtreme
|
||||
|
@ -253,10 +207,7 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Kohan: Immortal Sovereigns
|
||||
- Konung
|
||||
- Konung 2
|
||||
- Lands of Lore 2 Guardian of Destiny (Software mode only)
|
||||
- Lapis (lapis.mgame.com)
|
||||
- Last Bronx
|
||||
- Links Extreme
|
||||
- Lionheart - Legacy of the Crusader
|
||||
- Little Bear Kindergarten Thinking Adventures
|
||||
- Little Bear Preschool Thinking Adventures
|
||||
|
@ -264,27 +215,18 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Little Bear Toddler Discovery Adventures
|
||||
- Locomotion
|
||||
- Lode Runner 2
|
||||
- Lost Vikings 2
|
||||
- M.A.X. 2 Mechanized Assault & Exploration
|
||||
- Madeline 1st Grade Math
|
||||
- Madeline 2nd Grade Math
|
||||
- Mageslayer
|
||||
- Majesty Gold
|
||||
- Majesty Gold HD
|
||||
- Mario Sorb 3
|
||||
- Meat Puppet
|
||||
- M.A.X. 2 Mechanized Assault & Exploration
|
||||
- Mech Warrior 3
|
||||
- Megaman X4
|
||||
- Metal Gear Solid
|
||||
- Metal Knight
|
||||
- Mob Rule (AKA Constructor: Street Wars / Street Wars: Constructor Underworld)
|
||||
- Moorhuhn
|
||||
- Moorhuhn 2
|
||||
- Moorhuhn Adventure: Fluch des Goldes
|
||||
- Moorhuhn Adventure: Schatz des Pharao and Fluch des Goldes)
|
||||
- Moorhuhn Winter Editon
|
||||
- MiG-29 Fulcrum
|
||||
- Mission Deliver Kindness
|
||||
- Moto Racer
|
||||
- Moto Racer 2
|
||||
- Nancy Drew: Danger on Deception Island
|
||||
|
@ -294,37 +236,27 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Nancy Drew: Stay Tuned For Danger
|
||||
- Nancy Drew: The Secret of Shadow Ranch
|
||||
- Nancy Drew: Treasure in the Royal Tower
|
||||
- NBA Action '98
|
||||
- NBA Full Court Press
|
||||
- Need For Speed III: Hot Pursuit
|
||||
- Need For Speed: High Stakes
|
||||
- Neo Sonic Universe
|
||||
- New Robinson
|
||||
- NexusTk
|
||||
- Nightmare Creatures
|
||||
- Ninja Jonder Deluxe
|
||||
- Nox (Westwood - 2000)
|
||||
- Oddworld: Abe's Exoddus
|
||||
- Oddworld: Abe's Oddysee
|
||||
- Original War
|
||||
- Outlaws
|
||||
- Outlive
|
||||
- Outwars (software mode)
|
||||
- Pacific General
|
||||
- Pajama Sam
|
||||
- Pajama Sam 3
|
||||
- Pajama Sam 3: You Are What You Eat From Your Head To Your Feet
|
||||
- Pajama Sam's Games to Play on Any Day
|
||||
- Pajama Sam's One-Stop Fun Shop
|
||||
- Pajama Sam(r): Life is Rough When You Lose Your Stuff(tm)
|
||||
- Pajama Sam: No Need to Hide When It's Dark Outside
|
||||
- Pandora's Box Puzzle Game
|
||||
- Panzer Dragoon
|
||||
- Pajama Sam 3: You Are What You Eat From Your Head To Your Feet
|
||||
- Patrician 3
|
||||
- Pax Imperia
|
||||
- Pharaoh (Sierra - 1999)
|
||||
- Pizza Syndicate (AKA Fast Food Tycoon)
|
||||
- Platypus
|
||||
- Populous: The Beginning
|
||||
- Poseidon: Master of Atlantis
|
||||
- Pro Pinball - Big Race USA
|
||||
|
@ -337,7 +269,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Putt-Putt: Pep's Birthday Surprise
|
||||
- Putt-Putt: Travels Through Time
|
||||
- Quest for Glory 5
|
||||
- Rage of Mages
|
||||
- Rage of Mages 2
|
||||
- Railroad Tycoon II
|
||||
- Reader Rabbit 1st Grade
|
||||
|
@ -355,19 +286,14 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Reader Rabbit's(R) Math Ages 6 - 9 (2002)
|
||||
- Real War
|
||||
- Red Baron 3D
|
||||
- Reksio and Captain Nemo (Reksio i Kapitan Nemo)
|
||||
- Reksio and Kretes in Action (Reksio i Kretes w Akcji!)
|
||||
- Reksio and the Pirate Treasure (Reksio i Skarb Piratów)
|
||||
- Reksio and the Time Machine (Reksio i Wehikuł Czasu)
|
||||
- Reksio and the UFO (Reksio i Ufo)
|
||||
- Reksio and the Wizards (Reksio i Czarodzieje)
|
||||
- Rent-A-Hero
|
||||
- Resurrection - The Return of the Black Dragon (software mode)
|
||||
- Return to Krondor
|
||||
- Rising Lands (patched)
|
||||
- Reksio and the Time Machine (Reksio i Wehikuł Czasu)
|
||||
- Reksio and Captain Nemo (Reksio i Kapitan Nemo)
|
||||
- Reksio and Kretes in Action (Reksio i Kretes w Akcji!)
|
||||
- Road Rash
|
||||
- Robin Hood - The Legend of Sherwood
|
||||
- Roland Garros 98 (software mode)
|
||||
- RollerCoaster Tycoon
|
||||
- Sanitarium
|
||||
- Scooby-Doo(TM), Case File #2 The Scary Stone Dragon
|
||||
|
@ -377,39 +303,23 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Sega Touring Car
|
||||
- Septerra Core
|
||||
- Settlers 3
|
||||
- Seven Kingdoms II
|
||||
- Shadow Flare
|
||||
- Shadow Watch
|
||||
- Shogo - Mobile Armor Division
|
||||
- Silver (needs "SilverUK GeForce2 And Radeon Patch")
|
||||
- Sim City 3000
|
||||
- Sim Copter
|
||||
- SimTunes
|
||||
- Sim Theme Park (aka Theme Park World)
|
||||
- SimCoaster / Theme Park Inc
|
||||
- Simon the Sorcerer 1/2 (windows 95 version)
|
||||
- Sonic 3D Blast
|
||||
- Soldiers At War
|
||||
- Space Rangers
|
||||
- Spec Ops - Ranger Assault (software mode)
|
||||
- SpongeBob SquarePants: Typing
|
||||
- SPY Fox : Some Assembly Required
|
||||
- SPY Fox in Dry Cereal
|
||||
- SPY Fox: Hold the Mustard
|
||||
- SPY Fox: Operation Ozone
|
||||
- Squad Leader
|
||||
- Star Trek Away Team
|
||||
- Star Trek Generations
|
||||
- Star Wars Anakin's Speedway
|
||||
- Star Wars Early Learning Activity Center
|
||||
- Star Wars Episode I: The Gungan Frontier
|
||||
- Star Wars Jedi Knight: Dark Forces II
|
||||
- Star Wars Rebellion
|
||||
- Star Wars Yoda's Challenge
|
||||
- Star Wars: Droid Works
|
||||
- Star Wars: Galactic Battlegrounds
|
||||
- Star Wars: Galactic Battlegrounds: Clone Campaigns
|
||||
- Star Wars: Pit Droids
|
||||
- StarCraft
|
||||
- StarCraft: Broodwars
|
||||
- StarFlyers Alien Space Chase
|
||||
|
@ -422,68 +332,41 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine
|
|||
- Stronghold Crusader HD
|
||||
- Stronghold HD
|
||||
- Sudden Strike 2
|
||||
- Superbike 2000
|
||||
- Swarog
|
||||
- The Jungle Book Groove Party
|
||||
- The Curse Of Monkey Island
|
||||
- The Dig
|
||||
- The Last Express
|
||||
- The Missing on Lost Island
|
||||
- The Neverhood
|
||||
- The Next Worlds
|
||||
- The Powerpuff Girls - Princess Snorebucks
|
||||
- The Powerpuff Girls(TM) Mojo Jojo's Clone Zone
|
||||
- The Rocky Interactive Horror Show
|
||||
- The Sex Files
|
||||
- The X-Files DVD
|
||||
- Theme Hospital
|
||||
- Three Kingdoms: Fate of the Dragon
|
||||
- Throne of Darkness
|
||||
- Thunder Brigade
|
||||
- TianLong BaBu
|
||||
- Tone Rebellion
|
||||
- Total Annihilation
|
||||
- Total Annihilation (Unofficial Beta Patch v3.9.02)
|
||||
- Total Annihilation: Kingdoms
|
||||
- Toy Story
|
||||
- Tridonis
|
||||
- Twisted Metal
|
||||
- Twisted Metal 2
|
||||
- Tzar: The Burden of the Crown
|
||||
- Unreal
|
||||
- Uprising 2: Lead and Destroy
|
||||
- Uprising: Join or Die
|
||||
- Vermeer
|
||||
- Virtua Cop
|
||||
- Virtua Cop 2
|
||||
- Virtua Fighter 2
|
||||
- Virtua Fighter PC
|
||||
- Virtual Springfield
|
||||
- Virtual On: Cyber Troopers
|
||||
- WarGames
|
||||
- War Wind
|
||||
- War Wind II - Human Onslaught
|
||||
- Warcraft 2
|
||||
- WarCraft 2000: Nuclear Epidemic
|
||||
- Warcraft 2
|
||||
- Warlords 3: Darklords Rising
|
||||
- Warlords Battlecry
|
||||
- Warlords Battlecry 2
|
||||
- Warlords Battlecry 3
|
||||
- Weird War
|
||||
- Wheel Of Fortune
|
||||
- Wing Commander - The Kilrathi Saga
|
||||
- Wizardry 8
|
||||
- Wizards and Warriors
|
||||
- Worms 2
|
||||
- Worms Armageddon
|
||||
- Z & Z Expansion Kit
|
||||
- Zeus: Master of Olympus
|
||||
- Zoombinis Island Odyssey
|
||||
- Zoombinis Logical Journey
|
||||
- Zoombinis Mountain Rescue
|
||||
- Zork Nemesis
|
||||
- Zuma Deluxe
|
||||
- ...
|
||||
- ...
|
||||
|
||||
There are a lot more games supported but I don't usually update the list, just give it a try and if it doesn't work then check the [wiki](https://github.com/FunkyFr3sh/cnc-ddraw/wiki) and the instructions above.
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# uses: phobos2077/sfall@develop
|
||||
# with:
|
||||
# release-xp: true
|
||||
#
|
||||
#
|
||||
# - name: Copy sfall to mod directory
|
||||
# run: copy "${{ steps.sfall.outputs.release-xp }}" "my/mod/directory/ddraw.dll"
|
||||
#
|
||||
|
|
|
@ -10,6 +10,6 @@ set GIT6=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\
|
|||
set PATH=C:\w64devkit\bin;%GIT1%;%GIT2%;%GIT3%;%GIT4%;%GIT5%;%GIT6%;%PATH%
|
||||
|
||||
make clean
|
||||
make _WIN32_WINNT=0x0400
|
||||
make
|
||||
|
||||
pause
|
||||
|
|
|
@ -10,6 +10,6 @@ set GIT6=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\
|
|||
set PATH=C:\w64devkit\bin;%GIT1%;%GIT2%;%GIT3%;%GIT4%;%GIT5%;%GIT6%;%PATH%
|
||||
|
||||
make clean
|
||||
make DEBUG=1 _WIN32_WINNT=0x0400
|
||||
make DEBUG=1
|
||||
|
||||
pause
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
<ClCompile Include="src\crc32.c" />
|
||||
<ClCompile Include="src\ddclipper.c" />
|
||||
<ClCompile Include="src\debug.c" />
|
||||
<ClCompile Include="src\delay_imports.c" />
|
||||
<ClCompile Include="src\detours\creatwth.cpp" />
|
||||
<ClCompile Include="src\detours\detours.cpp" />
|
||||
<ClCompile Include="src\detours\disasm.cpp" />
|
||||
|
@ -78,10 +77,8 @@
|
|||
<ClInclude Include="inc\blt.h" />
|
||||
<ClInclude Include="inc\crc32.h" />
|
||||
<ClInclude Include="inc\d3d9shader.h" />
|
||||
<ClInclude Include="inc\d3dcaps.h" />
|
||||
<ClInclude Include="inc\ddclipper.h" />
|
||||
<ClInclude Include="inc\ddraw.h" />
|
||||
<ClInclude Include="inc\delay_imports.h" />
|
||||
<ClInclude Include="inc\directinput.h" />
|
||||
<ClInclude Include="inc\dllmain.h" />
|
||||
<ClInclude Include="inc\fps_limiter.h" />
|
||||
|
@ -92,7 +89,6 @@
|
|||
<ClInclude Include="inc\indeo.h" />
|
||||
<ClInclude Include="inc\ini.h" />
|
||||
<ClInclude Include="inc\keyboard.h" />
|
||||
<ClInclude Include="inc\palette.h" />
|
||||
<ClInclude Include="inc\patch.h" />
|
||||
<ClInclude Include="inc\utils.h" />
|
||||
<ClInclude Include="inc\hook.h" />
|
||||
|
@ -226,7 +222,7 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>avifil32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>dbghelp.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -268,7 +264,7 @@ echo #define GIT_BRANCH "%GIT_BRANCH%" >> %DST_FILE%
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>avifil32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -310,7 +306,7 @@ echo #define GIT_BRANCH "%GIT_BRANCH%" >> %DST_FILE%
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>avifil32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -352,7 +348,7 @@ echo #define GIT_BRANCH "%GIT_BRANCH%" >> %DST_FILE%
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>avifil32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>dbghelp.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -394,7 +390,7 @@ echo #define GIT_BRANCH "%GIT_BRANCH%" >> %DST_FILE%
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>avifil32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>dbghelp.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
|
|
@ -168,9 +168,6 @@
|
|||
<ClCompile Include="src\keyboard.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\delay_imports.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="inc\debug.h">
|
||||
|
@ -296,15 +293,6 @@
|
|||
<ClInclude Include="inc\keyboard.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\palette.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\d3dcaps.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\delay_imports.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res.rc">
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <SysUtils.hpp>
|
||||
#include <Registry.hpp>
|
||||
#include <System.Hash.hpp>
|
||||
#include <VersionHelpers.h>
|
||||
#include "ConfigFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
@ -131,31 +132,31 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
|
|||
ConfigForm->Caption = L"cnc-ddraw 配置";
|
||||
DisplayBtn->Caption = L"显示设置";
|
||||
AdvancedBtn->Caption = L"高级设置";
|
||||
HotkeyBtn->Caption = L"快捷键设置";
|
||||
HotkeyBtn->Caption = L"热键设置";
|
||||
CompatibilityBtn->Caption = L"兼容性设置";
|
||||
RestoreDefaultsBtn->Caption = L"恢复默认设置";
|
||||
PresentationLbl->Caption = L"显示方式";
|
||||
MaintasLbl->Caption = L"保持宽高比";
|
||||
VsyncLbl->Caption = L"启用垂直同步";
|
||||
MaintasLbl->Caption = L"保持纵横比";
|
||||
VsyncLbl->Caption = L"打开垂直同步";
|
||||
AdjmouseLbl->Caption = L"调整鼠标灵敏度";
|
||||
DevmodeLbl->Caption = L"将光标锁定到窗口/屏幕";
|
||||
DevmodeLbl->Caption = L"锁定光标到窗口/屏幕";
|
||||
RendererLbl->Caption = L"渲染器";
|
||||
BorderLbl->Caption = L"在窗口模式下显示窗口边框";
|
||||
SavesettingsLbl->Caption = L"记住窗口位置和大小";
|
||||
ShaderLbl->Caption = L"OpenGL 着色器";
|
||||
MaxfpsLbl->Caption = L"限制帧速率";
|
||||
BoxingLbl->Caption = L"启用整数缩放";
|
||||
ShaderLbl->Caption = L"OpenGL着色器";
|
||||
MaxfpsLbl->Caption = L"限制帧率";
|
||||
BoxingLbl->Caption = L"打开窗盒显示/整数缩放";
|
||||
ToggleWindowedLbl->Caption = L"切换窗口模式";
|
||||
MaximizeWindowLbl->Caption = L"最大化窗口";
|
||||
UnlockCursor1Lbl->Caption = L"解锁光标 1";
|
||||
UnlockCursor2Lbl->Caption = L"解锁光标 2";
|
||||
ScreenshotLbl->Caption = L"截图";
|
||||
MaxgameticksLbl->Caption = L"限制游戏速度";
|
||||
ScreenshotLbl->Caption = L"截屏";
|
||||
MaxgameticksLbl->Caption = L"限制游戏速率";
|
||||
NoactivateappLbl->Caption = L"修复损坏的Alt+Tab功能";
|
||||
ResolutionsLbl->Caption = L"解锁额外的屏幕分辨率";
|
||||
MinfpsLbl->Caption = L"强制高 FPS / 修复 Freesync/G-Sync 卡顿";
|
||||
SinglecpuLbl->Caption = L"修复低性能和声音问题";
|
||||
NonexclusiveLbl->Caption = L"修复不显示的视频/UI 元素";
|
||||
ResolutionsLbl->Caption = L"解锁其他屏幕分辨率";
|
||||
MinfpsLbl->Caption = L"强制高FPS / 修复使用Freesync/G-Sync的卡顿问题";
|
||||
SinglecpuLbl->Caption = L"修复性能不佳和声音问题";
|
||||
NonexclusiveLbl->Caption = L"修复不显示的视频/UI元素";
|
||||
|
||||
RendererCbx->Items->Clear();
|
||||
RendererCbx->AddItem(L"自动", NULL);
|
||||
|
@ -172,26 +173,25 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
|
|||
MaxgameticksCbx->Items->Clear();
|
||||
MaxgameticksCbx->AddItem(L"无限制", NULL);
|
||||
MaxgameticksCbx->AddItem(L"与显示器刷新率同步", NULL);
|
||||
MaxgameticksCbx->AddItem(L"模拟 60hz 刷新率显示器", NULL);
|
||||
MaxgameticksCbx->AddItem(L"1000 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"500 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"250 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"125 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"60 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"30 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"25 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"15 次每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"模拟60hz刷新率显示器", NULL);
|
||||
MaxgameticksCbx->AddItem(L"1000tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"500tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"250tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"125tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"60tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"30tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"25tick每秒", NULL);
|
||||
MaxgameticksCbx->AddItem(L"15tick每秒", NULL);
|
||||
|
||||
System::UnicodeString shaderHint =
|
||||
L"一些着色器只有在启用放大时才有效。\n\n";
|
||||
L"某些着色器仅在打开放大功能时生效。\n\n";
|
||||
|
||||
System::UnicodeString upscaleHint =
|
||||
L"必须启用放大才能使此设置生效。\n\n";
|
||||
L"必须打开放大功能才能使此设置生效。\n\n";
|
||||
|
||||
System::UnicodeString enableUpscaleHint =
|
||||
L"要启用放大,请将显示方式设置为“无边框” \n"
|
||||
"或“拉伸至全屏”。对于“窗口化”, \n"
|
||||
"你必须调整窗口大小或将窗口开启最大化。";
|
||||
L"要打开放大功能,请将显示方式设置为‘无边框’或‘拉伸至全屏’。\n"
|
||||
"对于‘窗口化’显示方式,您必须调整窗口大小或最大化窗口。";
|
||||
|
||||
ShaderLbl->Hint = shaderHint + enableUpscaleHint;
|
||||
ShaderD3DCbx->Hint = shaderHint + enableUpscaleHint;
|
||||
|
@ -773,87 +773,6 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
|
|||
BoxingLbl->Hint = upscaleHint + enableUpscaleHint;
|
||||
BoxingChk->Hint = upscaleHint + enableUpscaleHint;
|
||||
}
|
||||
else if (lang == "polish" || (lang == "auto" && priID == LANG_POLISH)) {
|
||||
LanguageImg->Visible = true;
|
||||
|
||||
/* -polish - made by WaRzillA @ github */
|
||||
|
||||
ConfigForm->Caption = L"Konfiguracja cnc-ddraw";
|
||||
DisplayBtn->Caption = L"Ustawienia wyświetlania";
|
||||
AdvancedBtn->Caption = L"Ustawienia zaawansowane";
|
||||
HotkeyBtn->Caption = L"Skróty klawiaturowe";
|
||||
CompatibilityBtn->Caption = L"Ustawienia kompatybilności";
|
||||
RestoreDefaultsBtn->Caption = L"Przywróć ustawienia domyślne";
|
||||
PresentationLbl->Caption = L"Tryb wyświetlania";
|
||||
MaintasLbl->Caption = L"Zachowaj proporcje obrazu";
|
||||
VsyncLbl->Caption = L"Włącz VSync";
|
||||
AdjmouseLbl->Caption = L"Dostosuj czułość myszy";
|
||||
DevmodeLbl->Caption = L"Zablokuj kursor w oknie/na ekranie";
|
||||
RendererLbl->Caption = L"Silnik renderowania";
|
||||
BorderLbl->Caption = L"Pokaż ramki okna w trybie okienkowym";
|
||||
SavesettingsLbl->Caption = L"Zapamiętaj pozycję i rozmiar okna";
|
||||
ShaderLbl->Caption = L"Shader OpenGL";
|
||||
MaxfpsLbl->Caption = L"Ogranicz liczbę klatek na sekundę";
|
||||
BoxingLbl->Caption = L"Włącz windowboxing / integer scaling ";
|
||||
ToggleWindowedLbl->Caption = L"Przełącz na tryb okienkowy";
|
||||
MaximizeWindowLbl->Caption = L"Maksymalizuj okno";
|
||||
UnlockCursor1Lbl->Caption = L"Odblokuj kursor 1";
|
||||
UnlockCursor2Lbl->Caption = L"Odblokuj kursor 2";
|
||||
ScreenshotLbl->Caption = L"Zrzut ekranu";
|
||||
MaxgameticksLbl->Caption = L"Ogranicz prędkość gry";
|
||||
NoactivateappLbl->Caption = L"Napraw nieprawidłowe działanie Alt+Tab";
|
||||
ResolutionsLbl->Caption = L"Odblokuj dodatkowe rozdzielczości ekranu";
|
||||
MinfpsLbl->Caption = L"Wymuś wysokie FPS / Napraw zacinanie Freesync/G-Sync";
|
||||
SinglecpuLbl->Caption = L"Napraw problemy z wydajnością i dźwiękiem";
|
||||
NonexclusiveLbl->Caption = L"Napraw niewidoczne filmy / elementy interfejsu";
|
||||
|
||||
RendererCbx->Items->Clear();
|
||||
RendererCbx->AddItem(L"Automatyczny", NULL);
|
||||
RendererCbx->AddItem(L"Direct3D 9", NULL);
|
||||
RendererCbx->AddItem(L"OpenGL", NULL);
|
||||
RendererCbx->AddItem(L"GDI", NULL);
|
||||
|
||||
PresentationCbx->Items->Clear();
|
||||
PresentationCbx->AddItem(L"Pełny ekran", NULL);
|
||||
PresentationCbx->AddItem(L"Pełny ekran z upscalingiem", NULL);
|
||||
PresentationCbx->AddItem(L"Tryb bezramkowy", NULL);
|
||||
PresentationCbx->AddItem(L"Tryb okienkowy", NULL);
|
||||
|
||||
MaxgameticksCbx->Items->Clear();
|
||||
MaxgameticksCbx->AddItem(L"Bez limitu", NULL);
|
||||
MaxgameticksCbx->AddItem(L"Synchronizacja z odświeżaniem monitora", NULL);
|
||||
MaxgameticksCbx->AddItem(L"Symulacja monitora 60 Hz", NULL);
|
||||
MaxgameticksCbx->AddItem(L"1000 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"500 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"250 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"125 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"60 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"30 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"25 tików na sekundę", NULL);
|
||||
MaxgameticksCbx->AddItem(L"15 tików na sekundę", NULL);
|
||||
|
||||
System::UnicodeString shaderHint =
|
||||
L"Niektóre shadery działają tylko wtedy, gdy włączone jest skalowanie. \n\n";
|
||||
|
||||
System::UnicodeString upscaleHint =
|
||||
L"Skalowanie musi być włączone, aby ta opcja działała. \n\n";
|
||||
|
||||
System::UnicodeString enableUpscaleHint =
|
||||
L"Aby włączyć skalowanie, ustaw tryb wyświetlania na 'Tryb bezramkowy' \n"
|
||||
"lub 'Pełny ekran z upscalingiem'. Dla 'Tryb okienkowy' \n"
|
||||
"musisz zmienić rozmiar lub zmaksymalizować okno.";
|
||||
|
||||
ShaderLbl->Hint = shaderHint + enableUpscaleHint;
|
||||
ShaderD3DCbx->Hint = shaderHint + enableUpscaleHint;
|
||||
ShaderCbx->Hint = shaderHint + enableUpscaleHint;
|
||||
|
||||
MaintasLbl->Hint = upscaleHint + enableUpscaleHint;
|
||||
MaintasChk->Hint = upscaleHint + enableUpscaleHint;
|
||||
AdjmouseLbl->Hint = upscaleHint + enableUpscaleHint;
|
||||
AdjmouseChk->Hint = upscaleHint + enableUpscaleHint;
|
||||
BoxingLbl->Hint = upscaleHint + enableUpscaleHint;
|
||||
BoxingChk->Hint = upscaleHint + enableUpscaleHint;
|
||||
}
|
||||
else {
|
||||
IsEnglish = true;
|
||||
|
||||
|
@ -906,12 +825,6 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
|
|||
LanguageImg->Picture->Graphic = png;
|
||||
LanguageImg->Visible = true;
|
||||
}
|
||||
else if (priID == LANG_POLISH) {
|
||||
TPngImage *png = new TPngImage();
|
||||
png->LoadFromResourceName((int)HInstance, "PngImage_PL");
|
||||
LanguageImg->Picture->Graphic = png;
|
||||
LanguageImg->Visible = true;
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1187,7 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
|
|||
MinfpsChk->State = Minfps != 0 ? tssOn : tssOff;
|
||||
|
||||
SinglecpuChk->State = GetBool(ini, "singlecpu", true) ? tssOff : tssOn;
|
||||
NonexclusiveChk->State = GetBool(ini, "nonexclusive", true) ? tssOn : tssOff;
|
||||
NonexclusiveChk->State = GetBool(ini, "nonexclusive", false) ? tssOn : tssOff;
|
||||
|
||||
CompatibilityBtn->Visible = !GetBool(ini, "hide_compat_tab", false);
|
||||
|
||||
|
@ -1285,6 +1198,11 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
|
|||
|
||||
delete ini;
|
||||
|
||||
VsyncChk->Enabled = VsyncAllowed();
|
||||
if (!VsyncChk->Enabled) {
|
||||
VsyncChk->State = tssOff;
|
||||
}
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
|
@ -1706,8 +1624,31 @@ bool TConfigForm::GetBool(TIniFile *ini, System::UnicodeString key, bool defValu
|
|||
return s == "true" || s == "yes" || s == "1";
|
||||
}
|
||||
|
||||
bool TConfigForm::VsyncAllowed()
|
||||
{
|
||||
if (GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IsWindows8OrGreater()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NonexclusiveChk->State == tssOff &&
|
||||
(PresentationCbx->ItemIndex == 0 || PresentationCbx->ItemIndex == 1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void __fastcall TConfigForm::PresentationCbxChange(TObject *Sender)
|
||||
{
|
||||
VsyncChk->Enabled = VsyncAllowed();
|
||||
if (!VsyncChk->Enabled) {
|
||||
VsyncChk->State = tssOff;
|
||||
}
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
@ -1816,6 +1757,11 @@ void __fastcall TConfigForm::SinglecpuChkClick(TObject *Sender)
|
|||
|
||||
void __fastcall TConfigForm::NonexclusiveChkClick(TObject *Sender)
|
||||
{
|
||||
VsyncChk->Enabled = VsyncAllowed();
|
||||
if (!VsyncChk->Enabled) {
|
||||
VsyncChk->State = tssOff;
|
||||
}
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -2677,7 +2677,7 @@ object ConfigForm: TConfigForm
|
|||
61C0650530766087F0B9DE67A1EF3B173173597F3B695CC608E0B202F8FC22D7
|
||||
BBBF4CD8CBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCB
|
||||
B88CB18EFF1FA2974C1C31AF16A40000000049454E44AE426082}
|
||||
Position = poScreenCenter
|
||||
Position = poDesktopCenter
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
DesignSize = (
|
||||
|
|
|
@ -118,6 +118,7 @@ private: // Benutzer-Deklarationen
|
|||
virtual void __fastcall CreateParams(TCreateParams & Params);
|
||||
void SaveSettings();
|
||||
bool GetBool(TIniFile *ini, System::UnicodeString key, bool defValue);
|
||||
bool VsyncAllowed();
|
||||
void ApplyTranslation(TIniFile *ini);
|
||||
System::UnicodeString GetKeyText(WORD key);
|
||||
WORD GetKeyCode(System::UnicodeString text);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 374 B |
|
@ -227,10 +227,6 @@
|
|||
<ResourceType>RCDATA</ResourceType>
|
||||
<ResourceId>PngImage_IT</ResourceId>
|
||||
</RcItem>
|
||||
<RcItem Include="Resources\pl.png">
|
||||
<ResourceType>RCDATA</ResourceType>
|
||||
<ResourceId>PngImage_PL</ResourceId>
|
||||
</RcItem>
|
||||
<RcItem Include="Resources\RU.png">
|
||||
<ResourceType>RCDATA</ResourceType>
|
||||
<ResourceId>PngImage_RU</ResourceId>
|
||||
|
@ -368,7 +364,7 @@
|
|||
<DeployFile LocalName=".\Win32\Release\cnc-ddraw config.exe" Configuration="Release" Class="ProjectOutput"/>
|
||||
<DeployFile LocalName=".\Win32\Release\cnc-ddraw config.exe" Configuration="Release" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>cnc-ddraw config.exe</RemoteName>
|
||||
<RemoteName>cnc-ddraw_config.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
|
@ -434,12 +430,6 @@
|
|||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="Resources\pl.png" Configuration="Release" Class="ProjectFile">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>.\</RemoteDir>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
|
|
|
@ -67,15 +67,4 @@ int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// dummy functions to avoid Wtsapi32.dll imports
|
||||
EXTERN_C BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
EXTERN_C BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -4,7 +4,6 @@ PngImage_ES RCDATA "Resources\\ES.png"
|
|||
PngImage_FR RCDATA "Resources\\fr.png"
|
||||
PngImage_HU RCDATA "Resources\\hu.png"
|
||||
PngImage_IT RCDATA "Resources\\IT.png"
|
||||
PngImage_PL RCDATA "Resources\\pl.png"
|
||||
PngImage_RU RCDATA "Resources\\RU.png"
|
||||
PngImage_US RCDATA "Resources\\US.png"
|
||||
PngImage_VN RCDATA "Resources\\VN.png"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "d3dcaps.h"
|
||||
|
||||
|
||||
DEFINE_GUID(IID_IDirect3D, 0x3BBA0080, 0x2421, 0x11CF, 0xA3, 0x1A, 0x00, 0xAA, 0x00, 0xB9, 0x33, 0x56);
|
||||
|
@ -11,9 +10,6 @@ DEFINE_GUID(IID_IDirect3D2, 0x6aae1ec1, 0x662a, 0x11d0, 0x88, 0x9d, 0x00, 0xaa,
|
|||
DEFINE_GUID(IID_IDirect3D3, 0xbb223240, 0xe72b, 0x11d0, 0xa9, 0xb4, 0x00, 0xaa, 0x00, 0xc0, 0x99, 0x3e);
|
||||
DEFINE_GUID(IID_IDirect3D7, 0xf5049e77, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
|
||||
|
||||
DEFINE_GUID(IID_IDirect3DNullDevice, 0x8767df22, 0xbacc, 0x11d1, 0x89, 0x69, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
|
||||
|
||||
|
||||
#define DECLARE_D3D_INTERFACE(iface) typedef struct iface { \
|
||||
struct iface##Vtbl FAR* lpVtbl; \
|
||||
ULONG ref; \
|
||||
|
@ -21,6 +17,7 @@ DEFINE_GUID(IID_IDirect3DNullDevice, 0x8767df22, 0xbacc, 0x11d1, 0x89, 0x69, 0x0
|
|||
typedef struct iface##Vtbl iface##Vtbl; \
|
||||
struct iface##Vtbl
|
||||
|
||||
|
||||
/* IID_IDirect3D */
|
||||
|
||||
DECLARE_D3D_INTERFACE(IDirect3DImpl)
|
||||
|
@ -30,7 +27,7 @@ DECLARE_D3D_INTERFACE(IDirect3DImpl)
|
|||
ULONG(__stdcall * Release) (IDirect3DImpl*);
|
||||
|
||||
HRESULT(__stdcall * Initialize)(IDirect3DImpl*, int);
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3DImpl*, LPD3DENUMDEVICESCALLBACK, LPVOID);
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3DImpl*, int, int);
|
||||
HRESULT(__stdcall * CreateLight)(IDirect3DImpl*, int, int);
|
||||
HRESULT(__stdcall * CreateMaterial)(IDirect3DImpl*, int, int);
|
||||
HRESULT(__stdcall * CreateViewport)(IDirect3DImpl*, int, int);
|
||||
|
@ -47,7 +44,7 @@ DECLARE_D3D_INTERFACE(IDirect3D2Impl)
|
|||
ULONG(__stdcall * AddRef) (IDirect3D2Impl*);
|
||||
ULONG(__stdcall * Release) (IDirect3D2Impl*);
|
||||
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3D2Impl*, LPD3DENUMDEVICESCALLBACK, LPVOID);
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3D2Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateLight)(IDirect3D2Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateMaterial)(IDirect3D2Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateViewport)(IDirect3D2Impl*, int, int);
|
||||
|
@ -65,7 +62,7 @@ DECLARE_D3D_INTERFACE(IDirect3D3Impl)
|
|||
ULONG(__stdcall * AddRef) (IDirect3D3Impl*);
|
||||
ULONG(__stdcall * Release) (IDirect3D3Impl*);
|
||||
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3D3Impl*, LPD3DENUMDEVICESCALLBACK, LPVOID);
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3D3Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateLight)(IDirect3D3Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateMaterial)(IDirect3D3Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateViewport)(IDirect3D3Impl*, int, int);
|
||||
|
@ -86,7 +83,7 @@ DECLARE_D3D_INTERFACE(IDirect3D7Impl)
|
|||
ULONG(__stdcall * AddRef) (IDirect3D7Impl*);
|
||||
ULONG(__stdcall * Release) (IDirect3D7Impl*);
|
||||
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3D7Impl*, LPD3DENUMDEVICESCALLBACK7, LPVOID);
|
||||
HRESULT(__stdcall * EnumDevices)(IDirect3D7Impl*, int, int);
|
||||
HRESULT(__stdcall * CreateDevice)(IDirect3D7Impl*, int, int, int);
|
||||
HRESULT(__stdcall * CreateVertexBuffer)(IDirect3D7Impl*, int, int, int);
|
||||
HRESULT(__stdcall * EnumZBufferFormats)(IDirect3D7Impl*, int, int, int);
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
#include "IDirectDraw.h"
|
||||
|
||||
|
||||
typedef struct DDBITMAPINFO{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[256];
|
||||
} DDBITMAPINFO;
|
||||
|
||||
struct IDirectDrawSurfaceImpl;
|
||||
struct IDirectDrawSurfaceImplVtbl;
|
||||
|
||||
|
@ -23,9 +18,9 @@ typedef struct IDirectDrawSurfaceImpl
|
|||
|
||||
ULONG ref;
|
||||
|
||||
DWORD bpp;
|
||||
DWORD width;
|
||||
DWORD height;
|
||||
DWORD bpp;
|
||||
DWORD size;
|
||||
DWORD flags;
|
||||
DWORD caps;
|
||||
|
@ -33,8 +28,6 @@ typedef struct IDirectDrawSurfaceImpl
|
|||
CRITICAL_SECTION cs;
|
||||
|
||||
IDirectDrawPaletteImpl* palette;
|
||||
PALETTEENTRY selected_pal[256];
|
||||
UINT selected_pal_count;
|
||||
|
||||
void* surface;
|
||||
HANDLE mapping;
|
||||
|
|
29
inc/config.h
29
inc/config.h
|
@ -22,7 +22,7 @@ typedef struct CNCDDRAWCONFIG
|
|||
INIFILE ini;
|
||||
BOOL d3d9on12;
|
||||
BOOL opengl_core;
|
||||
|
||||
|
||||
/* Optional settings */
|
||||
|
||||
BOOL fullscreen;
|
||||
|
@ -42,8 +42,6 @@ typedef struct CNCDDRAWCONFIG
|
|||
int d3d9_filter;
|
||||
int anti_aliased_fonts_min_size;
|
||||
int min_font_size;
|
||||
int center_window;
|
||||
char inject_resolution[128];
|
||||
BOOL vhack;
|
||||
char screenshot_dir[MAX_PATH];
|
||||
BOOL toggle_borderless;
|
||||
|
@ -59,37 +57,36 @@ typedef struct CNCDDRAWCONFIG
|
|||
BOOL singlecpu;
|
||||
int resolutions;
|
||||
int fixchilds;
|
||||
BOOL hook_peekmessage;
|
||||
|
||||
/* Undocumented settings */
|
||||
|
||||
BOOL fix_alt_key_stuck;
|
||||
BOOL fix_not_responding;
|
||||
BOOL no_compat_warning;
|
||||
BOOL releasealt;
|
||||
BOOL fixnotresponding;
|
||||
int hook;
|
||||
int guard_lines;
|
||||
int max_resolutions;
|
||||
BOOL lock_surfaces;
|
||||
BOOL flipclear;
|
||||
BOOL fixmousehook;
|
||||
BOOL rgb555;
|
||||
BOOL no_dinput_hook;
|
||||
int refresh_rate;
|
||||
char inject_resolution[128];
|
||||
BOOL direct3d_passthrough;
|
||||
BOOL center_cursor_fix;
|
||||
char fake_mode[128];
|
||||
BOOL wine_allow_resize;
|
||||
BOOL lock_mouse_top_left;
|
||||
char win_version[32];
|
||||
int hook;
|
||||
BOOL limit_gdi_handles;
|
||||
BOOL no_compat_warning;
|
||||
BOOL remove_menu;
|
||||
int refresh_rate;
|
||||
int terminate_process;
|
||||
char win_version[32];
|
||||
|
||||
/* Hotkeys */
|
||||
|
||||
struct
|
||||
{
|
||||
int toggle_fullscreen;
|
||||
int toggle_fullscreen2;
|
||||
int toggle_maximize;
|
||||
int toggle_maximize2;
|
||||
int unlock_cursor1;
|
||||
int unlock_cursor2;
|
||||
int screenshot;
|
||||
|
@ -103,10 +100,8 @@ typedef struct CNCDDRAWCONFIG
|
|||
BOOL stronghold_hack;
|
||||
BOOL mgs_hack;
|
||||
BOOL tlc_hack;
|
||||
BOOL homm_hack;
|
||||
BOOL carma95_hack;
|
||||
BOOL sirtech_hack;
|
||||
BOOL flightsim98_hack;
|
||||
BOOL darkcolony_hack;
|
||||
|
||||
} CNCDDRAWCONFIG;
|
||||
|
||||
|
|
|
@ -6,6 +6,5 @@
|
|||
|
||||
|
||||
unsigned long Crc32_ComputeBuf(unsigned long inCrc32, const void* buf, size_t bufLen);
|
||||
unsigned long Crc32_FromFile(unsigned long crc32, char* filename);
|
||||
|
||||
#endif
|
||||
|
|
607
inc/d3dcaps.h
607
inc/d3dcaps.h
|
@ -1,607 +0,0 @@
|
|||
/*==========================================================================;
|
||||
*
|
||||
* Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
*
|
||||
* File: d3dcaps.h
|
||||
* Content: Direct3D capabilities include file
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _D3DCAPS_H
|
||||
#define _D3DCAPS_H
|
||||
|
||||
/*
|
||||
* Pull in DirectDraw include file automatically:
|
||||
*/
|
||||
#include "ddraw.h"
|
||||
|
||||
#ifndef DIRECT3D_VERSION
|
||||
#define DIRECT3D_VERSION 0x0700
|
||||
#endif
|
||||
|
||||
#if defined(_X86_) || defined(_IA64_)
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
|
||||
/* Description of capabilities of transform */
|
||||
|
||||
typedef struct _D3DTRANSFORMCAPS {
|
||||
DWORD dwSize;
|
||||
DWORD dwCaps;
|
||||
} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS;
|
||||
|
||||
#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */
|
||||
|
||||
/* Description of capabilities of lighting */
|
||||
|
||||
typedef struct _D3DLIGHTINGCAPS {
|
||||
DWORD dwSize;
|
||||
DWORD dwCaps; /* Lighting caps */
|
||||
DWORD dwLightingModel; /* Lighting model - RGB or mono */
|
||||
DWORD dwNumLights; /* Number of lights that can be handled */
|
||||
} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS;
|
||||
|
||||
#define D3DLIGHTINGMODEL_RGB 0x00000001L
|
||||
#define D3DLIGHTINGMODEL_MONO 0x00000002L
|
||||
|
||||
#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */
|
||||
#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */
|
||||
#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */
|
||||
#if(DIRECT3D_VERSION < 0x700)
|
||||
#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */
|
||||
#endif
|
||||
#if(DIRECT3D_VERSION < 0x500)
|
||||
#define D3DLIGHTCAPS_GLSPOT 0x00000010L /* GL syle spot lights supported */
|
||||
#endif
|
||||
|
||||
/* Description of capabilities for each primitive type */
|
||||
|
||||
typedef struct _D3DPrimCaps {
|
||||
DWORD dwSize;
|
||||
DWORD dwMiscCaps; /* Capability flags */
|
||||
DWORD dwRasterCaps;
|
||||
DWORD dwZCmpCaps;
|
||||
DWORD dwSrcBlendCaps;
|
||||
DWORD dwDestBlendCaps;
|
||||
DWORD dwAlphaCmpCaps;
|
||||
DWORD dwShadeCaps;
|
||||
DWORD dwTextureCaps;
|
||||
DWORD dwTextureFilterCaps;
|
||||
DWORD dwTextureBlendCaps;
|
||||
DWORD dwTextureAddressCaps;
|
||||
DWORD dwStippleWidth; /* maximum width and height of */
|
||||
DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */
|
||||
} D3DPRIMCAPS, *LPD3DPRIMCAPS;
|
||||
|
||||
/* D3DPRIMCAPS dwMiscCaps */
|
||||
|
||||
#define D3DPMISCCAPS_MASKPLANES 0x00000001L
|
||||
#define D3DPMISCCAPS_MASKZ 0x00000002L
|
||||
#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L
|
||||
#define D3DPMISCCAPS_CONFORMANT 0x00000008L
|
||||
#define D3DPMISCCAPS_CULLNONE 0x00000010L
|
||||
#define D3DPMISCCAPS_CULLCW 0x00000020L
|
||||
#define D3DPMISCCAPS_CULLCCW 0x00000040L
|
||||
|
||||
/* D3DPRIMCAPS dwRasterCaps */
|
||||
|
||||
#define D3DPRASTERCAPS_DITHER 0x00000001L
|
||||
#define D3DPRASTERCAPS_ROP2 0x00000002L
|
||||
#define D3DPRASTERCAPS_XOR 0x00000004L
|
||||
#define D3DPRASTERCAPS_PAT 0x00000008L
|
||||
#define D3DPRASTERCAPS_ZTEST 0x00000010L
|
||||
#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L
|
||||
#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L
|
||||
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
|
||||
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
|
||||
#define D3DPRASTERCAPS_STIPPLE 0x00000200L
|
||||
#if(DIRECT3D_VERSION >= 0x0500)
|
||||
#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400L
|
||||
#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800L
|
||||
#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L
|
||||
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
|
||||
#define D3DPRASTERCAPS_ZBIAS 0x00004000L
|
||||
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
|
||||
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
|
||||
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
|
||||
#endif /* DIRECT3D_VERSION >= 0x0500 */
|
||||
#if(DIRECT3D_VERSION >= 0x0600)
|
||||
#define D3DPRASTERCAPS_WBUFFER 0x00040000L
|
||||
#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT 0x00080000L
|
||||
#define D3DPRASTERCAPS_WFOG 0x00100000L
|
||||
#define D3DPRASTERCAPS_ZFOG 0x00200000L
|
||||
#endif /* DIRECT3D_VERSION >= 0x0600 */
|
||||
|
||||
/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */
|
||||
|
||||
#define D3DPCMPCAPS_NEVER 0x00000001L
|
||||
#define D3DPCMPCAPS_LESS 0x00000002L
|
||||
#define D3DPCMPCAPS_EQUAL 0x00000004L
|
||||
#define D3DPCMPCAPS_LESSEQUAL 0x00000008L
|
||||
#define D3DPCMPCAPS_GREATER 0x00000010L
|
||||
#define D3DPCMPCAPS_NOTEQUAL 0x00000020L
|
||||
#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L
|
||||
#define D3DPCMPCAPS_ALWAYS 0x00000080L
|
||||
|
||||
/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */
|
||||
|
||||
#define D3DPBLENDCAPS_ZERO 0x00000001L
|
||||
#define D3DPBLENDCAPS_ONE 0x00000002L
|
||||
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L
|
||||
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L
|
||||
#define D3DPBLENDCAPS_SRCALPHA 0x00000010L
|
||||
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L
|
||||
#define D3DPBLENDCAPS_DESTALPHA 0x00000040L
|
||||
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L
|
||||
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L
|
||||
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L
|
||||
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L
|
||||
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L
|
||||
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
|
||||
|
||||
/* D3DPRIMCAPS dwShadeCaps */
|
||||
|
||||
#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L
|
||||
#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L
|
||||
#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L
|
||||
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L
|
||||
#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L
|
||||
#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L
|
||||
|
||||
#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L
|
||||
#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L
|
||||
#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L
|
||||
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L
|
||||
#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L
|
||||
#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L
|
||||
|
||||
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L
|
||||
#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L
|
||||
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L
|
||||
#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L
|
||||
#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L
|
||||
#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L
|
||||
|
||||
#define D3DPSHADECAPS_FOGFLAT 0x00040000L
|
||||
#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L
|
||||
#define D3DPSHADECAPS_FOGPHONG 0x00100000L
|
||||
|
||||
/* D3DPRIMCAPS dwTextureCaps */
|
||||
|
||||
/*
|
||||
* Perspective-correct texturing is supported
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L
|
||||
|
||||
/*
|
||||
* Power-of-2 texture dimensions are required
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_POW2 0x00000002L
|
||||
|
||||
/*
|
||||
* Alpha in texture pixels is supported
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_ALPHA 0x00000004L
|
||||
|
||||
/*
|
||||
* Color-keyed textures are supported
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L
|
||||
|
||||
/*
|
||||
* obsolete, see D3DPTADDRESSCAPS_BORDER
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_BORDER 0x00000010L
|
||||
|
||||
/*
|
||||
* Only square textures are supported
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L
|
||||
|
||||
#if(DIRECT3D_VERSION >= 0x0600)
|
||||
/*
|
||||
* Texture indices are not scaled by the texture size prior
|
||||
* to interpolation.
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L
|
||||
|
||||
/*
|
||||
* Device can draw alpha from texture palettes
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L
|
||||
|
||||
/*
|
||||
* Device can use non-POW2 textures if:
|
||||
* 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
|
||||
* 2) D3DRS_WRAP(N) is zero for this texture's coordinates
|
||||
* 3) mip mapping is not enabled (use magnification filter only)
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L
|
||||
|
||||
#endif /* DIRECT3D_VERSION >= 0x0600 */
|
||||
#if(DIRECT3D_VERSION >= 0x0700)
|
||||
|
||||
// 0x00000200L unused
|
||||
|
||||
/*
|
||||
* Device can divide transformed texture coordinates by the
|
||||
* COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_PROJECTED 0x00000400L
|
||||
|
||||
/*
|
||||
* Device can do cubemap textures
|
||||
*/
|
||||
#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L
|
||||
|
||||
#define D3DPTEXTURECAPS_COLORKEYBLEND 0x00001000L
|
||||
#endif /* DIRECT3D_VERSION >= 0x0700 */
|
||||
|
||||
/* D3DPRIMCAPS dwTextureFilterCaps */
|
||||
|
||||
#define D3DPTFILTERCAPS_NEAREST 0x00000001L
|
||||
#define D3DPTFILTERCAPS_LINEAR 0x00000002L
|
||||
#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L
|
||||
#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L
|
||||
#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L
|
||||
#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L
|
||||
|
||||
#if(DIRECT3D_VERSION >= 0x0600)
|
||||
/* Device3 Min Filter */
|
||||
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L
|
||||
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L
|
||||
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L
|
||||
|
||||
/* Device3 Mip Filter */
|
||||
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L
|
||||
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L
|
||||
|
||||
/* Device3 Mag Filter */
|
||||
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L
|
||||
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L
|
||||
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L
|
||||
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L
|
||||
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L
|
||||
#endif /* DIRECT3D_VERSION >= 0x0600 */
|
||||
|
||||
/* D3DPRIMCAPS dwTextureBlendCaps */
|
||||
|
||||
#define D3DPTBLENDCAPS_DECAL 0x00000001L
|
||||
#define D3DPTBLENDCAPS_MODULATE 0x00000002L
|
||||
#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L
|
||||
#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L
|
||||
#define D3DPTBLENDCAPS_DECALMASK 0x00000010L
|
||||
#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L
|
||||
#define D3DPTBLENDCAPS_COPY 0x00000040L
|
||||
#if(DIRECT3D_VERSION >= 0x0500)
|
||||
#define D3DPTBLENDCAPS_ADD 0x00000080L
|
||||
#endif /* DIRECT3D_VERSION >= 0x0500 */
|
||||
|
||||
/* D3DPRIMCAPS dwTextureAddressCaps */
|
||||
#define D3DPTADDRESSCAPS_WRAP 0x00000001L
|
||||
#define D3DPTADDRESSCAPS_MIRROR 0x00000002L
|
||||
#define D3DPTADDRESSCAPS_CLAMP 0x00000004L
|
||||
#if(DIRECT3D_VERSION >= 0x0500)
|
||||
#define D3DPTADDRESSCAPS_BORDER 0x00000008L
|
||||
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L
|
||||
#endif /* DIRECT3D_VERSION >= 0x0500 */
|
||||
|
||||
#if(DIRECT3D_VERSION >= 0x0600)
|
||||
|
||||
/* D3DDEVICEDESC dwStencilCaps */
|
||||
|
||||
#define D3DSTENCILCAPS_KEEP 0x00000001L
|
||||
#define D3DSTENCILCAPS_ZERO 0x00000002L
|
||||
#define D3DSTENCILCAPS_REPLACE 0x00000004L
|
||||
#define D3DSTENCILCAPS_INCRSAT 0x00000008L
|
||||
#define D3DSTENCILCAPS_DECRSAT 0x00000010L
|
||||
#define D3DSTENCILCAPS_INVERT 0x00000020L
|
||||
#define D3DSTENCILCAPS_INCR 0x00000040L
|
||||
#define D3DSTENCILCAPS_DECR 0x00000080L
|
||||
|
||||
/* D3DDEVICEDESC dwTextureOpCaps */
|
||||
|
||||
#define D3DTEXOPCAPS_DISABLE 0x00000001L
|
||||
#define D3DTEXOPCAPS_SELECTARG1 0x00000002L
|
||||
#define D3DTEXOPCAPS_SELECTARG2 0x00000004L
|
||||
#define D3DTEXOPCAPS_MODULATE 0x00000008L
|
||||
#define D3DTEXOPCAPS_MODULATE2X 0x00000010L
|
||||
#define D3DTEXOPCAPS_MODULATE4X 0x00000020L
|
||||
#define D3DTEXOPCAPS_ADD 0x00000040L
|
||||
#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L
|
||||
#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L
|
||||
#define D3DTEXOPCAPS_SUBTRACT 0x00000200L
|
||||
#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L
|
||||
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L
|
||||
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L
|
||||
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L
|
||||
#define D3DTEXOPCAPS_PREMODULATE 0x00010000L
|
||||
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L
|
||||
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L
|
||||
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L
|
||||
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L
|
||||
#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L
|
||||
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L
|
||||
#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L
|
||||
|
||||
/* D3DDEVICEDESC dwFVFCaps flags */
|
||||
|
||||
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */
|
||||
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */
|
||||
|
||||
#endif /* DIRECT3D_VERSION >= 0x0600 */
|
||||
|
||||
typedef float D3DVALUE, *LPD3DVALUE;
|
||||
typedef DWORD D3DCOLORMODEL;
|
||||
|
||||
/*
|
||||
* Description for a device.
|
||||
* This is used to describe a device that is to be created or to query
|
||||
* the current device.
|
||||
*/
|
||||
typedef struct _D3DDeviceDesc {
|
||||
DWORD dwSize; /* Size of D3DDEVICEDESC structure */
|
||||
DWORD dwFlags; /* Indicates which fields have valid data */
|
||||
D3DCOLORMODEL dcmColorModel; /* Color model of device */
|
||||
DWORD dwDevCaps; /* Capabilities of device */
|
||||
D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */
|
||||
BOOL bClipping; /* Device can do 3D clipping */
|
||||
D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */
|
||||
D3DPRIMCAPS dpcLineCaps;
|
||||
D3DPRIMCAPS dpcTriCaps;
|
||||
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
|
||||
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
|
||||
DWORD dwMaxBufferSize; /* Maximum execute buffer size */
|
||||
DWORD dwMaxVertexCount; /* Maximum vertex count */
|
||||
//#if(DIRECT3D_VERSION >= 0x0500)
|
||||
// *** New fields for DX5 *** //
|
||||
|
||||
// Width and height caps are 0 for legacy HALs.
|
||||
DWORD dwMinTextureWidth, dwMinTextureHeight;
|
||||
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
|
||||
DWORD dwMinStippleWidth, dwMaxStippleWidth;
|
||||
DWORD dwMinStippleHeight, dwMaxStippleHeight;
|
||||
//#endif /* DIRECT3D_VERSION >= 0x0500 */
|
||||
|
||||
//#if(DIRECT3D_VERSION >= 0x0600)
|
||||
// New fields for DX6
|
||||
DWORD dwMaxTextureRepeat;
|
||||
DWORD dwMaxTextureAspectRatio;
|
||||
DWORD dwMaxAnisotropy;
|
||||
|
||||
// Guard band that the rasterizer can accommodate
|
||||
// Screen-space vertices inside this space but outside the viewport
|
||||
// will get clipped properly.
|
||||
D3DVALUE dvGuardBandLeft;
|
||||
D3DVALUE dvGuardBandTop;
|
||||
D3DVALUE dvGuardBandRight;
|
||||
D3DVALUE dvGuardBandBottom;
|
||||
|
||||
D3DVALUE dvExtentsAdjust;
|
||||
DWORD dwStencilCaps;
|
||||
|
||||
DWORD dwFVFCaps;
|
||||
DWORD dwTextureOpCaps;
|
||||
WORD wMaxTextureBlendStages;
|
||||
WORD wMaxSimultaneousTextures;
|
||||
//#endif /* DIRECT3D_VERSION >= 0x0600 */
|
||||
} D3DDEVICEDESC, *LPD3DDEVICEDESC;
|
||||
|
||||
#if(DIRECT3D_VERSION >= 0x0700)
|
||||
typedef struct _D3DDeviceDesc7 {
|
||||
DWORD dwDevCaps; /* Capabilities of device */
|
||||
D3DPRIMCAPS dpcLineCaps;
|
||||
D3DPRIMCAPS dpcTriCaps;
|
||||
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
|
||||
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
|
||||
|
||||
DWORD dwMinTextureWidth, dwMinTextureHeight;
|
||||
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
|
||||
|
||||
DWORD dwMaxTextureRepeat;
|
||||
DWORD dwMaxTextureAspectRatio;
|
||||
DWORD dwMaxAnisotropy;
|
||||
|
||||
D3DVALUE dvGuardBandLeft;
|
||||
D3DVALUE dvGuardBandTop;
|
||||
D3DVALUE dvGuardBandRight;
|
||||
D3DVALUE dvGuardBandBottom;
|
||||
|
||||
D3DVALUE dvExtentsAdjust;
|
||||
DWORD dwStencilCaps;
|
||||
|
||||
DWORD dwFVFCaps;
|
||||
DWORD dwTextureOpCaps;
|
||||
WORD wMaxTextureBlendStages;
|
||||
WORD wMaxSimultaneousTextures;
|
||||
|
||||
DWORD dwMaxActiveLights;
|
||||
D3DVALUE dvMaxVertexW;
|
||||
GUID deviceGUID;
|
||||
|
||||
WORD wMaxUserClipPlanes;
|
||||
WORD wMaxVertexBlendMatrices;
|
||||
|
||||
DWORD dwVertexProcessingCaps;
|
||||
|
||||
DWORD dwReserved1;
|
||||
DWORD dwReserved2;
|
||||
DWORD dwReserved3;
|
||||
DWORD dwReserved4;
|
||||
} D3DDEVICEDESC7, *LPD3DDEVICEDESC7;
|
||||
#endif /* DIRECT3D_VERSION >= 0x0700 */
|
||||
|
||||
#define D3DDEVICEDESCSIZE (sizeof(D3DDEVICEDESC))
|
||||
#define D3DDEVICEDESC7SIZE (sizeof(D3DDEVICEDESC7))
|
||||
|
||||
typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK)(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID);
|
||||
|
||||
//#if(DIRECT3D_VERSION >= 0x0700)
|
||||
typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK7)(LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID);
|
||||
//#endif /* DIRECT3D_VERSION >= 0x0700 */
|
||||
|
||||
/* D3DDEVICEDESC dwFlags indicating valid fields */
|
||||
|
||||
#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */
|
||||
#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */
|
||||
#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */
|
||||
#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */
|
||||
#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */
|
||||
#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */
|
||||
#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */
|
||||
#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */
|
||||
#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */
|
||||
#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */
|
||||
#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */
|
||||
|
||||
/* D3DDEVICEDESC dwDevCaps flags */
|
||||
|
||||
#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */
|
||||
/* for post-transform vertex data */
|
||||
#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z */
|
||||
#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z */
|
||||
#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */
|
||||
|
||||
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */
|
||||
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */
|
||||
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */
|
||||
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */
|
||||
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */
|
||||
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */
|
||||
#if(DIRECT3D_VERSION >= 0x0500)
|
||||
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */
|
||||
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */
|
||||
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */
|
||||
#endif /* DIRECT3D_VERSION >= 0x0500 */
|
||||
#if(DIRECT3D_VERSION >= 0x0600)
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */
|
||||
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/
|
||||
#endif /* DIRECT3D_VERSION >= 0x0600 */
|
||||
#if(DIRECT3D_VERSION >= 0x0700)
|
||||
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */
|
||||
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */
|
||||
#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */
|
||||
|
||||
/*
|
||||
* These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
|
||||
*/
|
||||
|
||||
/* device can do texgen */
|
||||
#define D3DVTXPCAPS_TEXGEN 0x00000001L
|
||||
/* device can do IDirect3DDevice7 colormaterialsource ops */
|
||||
#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L
|
||||
/* device can do vertex fog */
|
||||
#define D3DVTXPCAPS_VERTEXFOG 0x00000004L
|
||||
/* device can do directional lights */
|
||||
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L
|
||||
/* device can do positional lights (includes point and spot) */
|
||||
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L
|
||||
/* device can do local viewer */
|
||||
#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L
|
||||
|
||||
#endif /* DIRECT3D_VERSION >= 0x0700 */
|
||||
|
||||
#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */
|
||||
#define D3DFDS_GUID 0x00000002L /* Match guid */
|
||||
#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */
|
||||
#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */
|
||||
#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */
|
||||
#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */
|
||||
#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */
|
||||
#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */
|
||||
#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */
|
||||
#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */
|
||||
#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */
|
||||
#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */
|
||||
#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */
|
||||
#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */
|
||||
#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */
|
||||
#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */
|
||||
|
||||
/*
|
||||
* FindDevice arguments
|
||||
*/
|
||||
typedef struct _D3DFINDDEVICESEARCH {
|
||||
DWORD dwSize;
|
||||
DWORD dwFlags;
|
||||
BOOL bHardware;
|
||||
D3DCOLORMODEL dcmColorModel;
|
||||
GUID guid;
|
||||
DWORD dwCaps;
|
||||
D3DPRIMCAPS dpcPrimCaps;
|
||||
} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH;
|
||||
|
||||
typedef struct _D3DFINDDEVICERESULT {
|
||||
DWORD dwSize;
|
||||
GUID guid; /* guid which matched */
|
||||
D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */
|
||||
D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */
|
||||
} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT;
|
||||
|
||||
/*
|
||||
* Description of execute buffer.
|
||||
*/
|
||||
typedef struct _D3DExecuteBufferDesc {
|
||||
DWORD dwSize; /* size of this structure */
|
||||
DWORD dwFlags; /* flags indicating which fields are valid */
|
||||
DWORD dwCaps; /* capabilities of execute buffer */
|
||||
DWORD dwBufferSize; /* size of execute buffer data */
|
||||
LPVOID lpData; /* pointer to actual data */
|
||||
} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC;
|
||||
|
||||
/* D3DEXECUTEBUFFER dwFlags indicating valid fields */
|
||||
|
||||
#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */
|
||||
#define D3DDEB_CAPS 0x00000002l /* caps valid */
|
||||
#define D3DDEB_LPDATA 0x00000004l /* lpData valid */
|
||||
|
||||
/* D3DEXECUTEBUFFER dwCaps */
|
||||
|
||||
#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */
|
||||
#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */
|
||||
#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY)
|
||||
|
||||
#if(DIRECT3D_VERSION < 0x0800)
|
||||
|
||||
#if(DIRECT3D_VERSION >= 0x0700)
|
||||
typedef struct _D3DDEVINFO_TEXTUREMANAGER {
|
||||
BOOL bThrashing; /* indicates if thrashing */
|
||||
DWORD dwApproxBytesDownloaded; /* Approximate number of bytes downloaded by texture manager */
|
||||
DWORD dwNumEvicts; /* number of textures evicted */
|
||||
DWORD dwNumVidCreates; /* number of textures created in video memory */
|
||||
DWORD dwNumTexturesUsed; /* number of textures used */
|
||||
DWORD dwNumUsedTexInVid; /* number of used textures present in video memory */
|
||||
DWORD dwWorkingSet; /* number of textures in video memory */
|
||||
DWORD dwWorkingSetBytes; /* number of bytes in video memory */
|
||||
DWORD dwTotalManaged; /* total number of managed textures */
|
||||
DWORD dwTotalBytes; /* total number of bytes of managed textures */
|
||||
DWORD dwLastPri; /* priority of last texture evicted */
|
||||
} D3DDEVINFO_TEXTUREMANAGER, *LPD3DDEVINFO_TEXTUREMANAGER;
|
||||
|
||||
typedef struct _D3DDEVINFO_TEXTURING {
|
||||
DWORD dwNumLoads; /* counts Load() API calls */
|
||||
DWORD dwApproxBytesLoaded; /* Approximate number bytes loaded via Load() */
|
||||
DWORD dwNumPreLoads; /* counts PreLoad() API calls */
|
||||
DWORD dwNumSet; /* counts SetTexture() API calls */
|
||||
DWORD dwNumCreates; /* counts texture creates */
|
||||
DWORD dwNumDestroys; /* counts texture destroys */
|
||||
DWORD dwNumSetPriorities; /* counts SetPriority() API calls */
|
||||
DWORD dwNumSetLODs; /* counts SetLOD() API calls */
|
||||
DWORD dwNumLocks; /* counts number of texture locks */
|
||||
DWORD dwNumGetDCs; /* counts number of GetDCs to textures */
|
||||
} D3DDEVINFO_TEXTURING, *LPD3DDEVINFO_TEXTURING;
|
||||
#endif /* DIRECT3D_VERSION >= 0x0700 */
|
||||
|
||||
#endif //(DIRECT3D_VERSION < 0x0800)
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#endif /* _D3DCAPS_H_ */
|
||||
|
||||
|
18
inc/dd.h
18
inc/dd.h
|
@ -51,11 +51,6 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
|
|||
#define LIMIT_TESTCOOP 1
|
||||
#define LIMIT_BLTFAST 2
|
||||
#define LIMIT_UNLOCK 3
|
||||
#define LIMIT_PEEKMESSAGE 4
|
||||
|
||||
#define CENTER_WINDOW_NEVER 0
|
||||
#define CENTER_WINDOW_AUTO 1
|
||||
#define CENTER_WINDOW_ALWAYS 2
|
||||
|
||||
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
|
||||
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002
|
||||
|
@ -65,18 +60,6 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
|
|||
#define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
|
||||
#define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
||||
#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
||||
#define GdiTransparentBlt TransparentBlt
|
||||
#endif
|
||||
|
||||
typedef struct SPEEDLIMITER
|
||||
{
|
||||
DWORD tick_length;
|
||||
|
@ -127,7 +110,6 @@ typedef struct CNCDDRAW
|
|||
LONG palette_updated;
|
||||
LONG surface_updated;
|
||||
LONG clear_screen;
|
||||
LONG screen_updated;
|
||||
|
||||
float scale_w;
|
||||
float scale_h;
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "IDirectDrawPalette.h"
|
||||
#include "dd.h"
|
||||
|
||||
#define DDPCAPS_REFRESH_CHANGED_ONLY (1 << 31)
|
||||
|
||||
HRESULT ddp_GetEntries(IDirectDrawPaletteImpl* This, DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries);
|
||||
HRESULT ddp_SetEntries(IDirectDrawPaletteImpl* This, DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries);
|
||||
HRESULT dd_CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, IDirectDrawPaletteImpl** lpDDPalette, IUnknown FAR* unkOuter);
|
||||
|
|
12
inc/debug.h
12
inc/debug.h
|
@ -6,7 +6,6 @@
|
|||
#include <intrin.h>
|
||||
|
||||
LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception);
|
||||
LONG WINAPI dbg_vectored_exception_handler(EXCEPTION_POINTERS* exception);
|
||||
void dbg_counter_start();
|
||||
double dbg_counter_stop();
|
||||
void dbg_debug_string(const char* format, ...);
|
||||
|
@ -27,16 +26,19 @@ void dbg_dump_dds_caps(DWORD caps);
|
|||
void dbg_dump_dds_flags(DWORD flags);
|
||||
void dbg_dump_dds_blt_fast_flags(DWORD flags);
|
||||
void dbg_dump_dds_lock_flags(DWORD flags);
|
||||
void dbg_dump_di_scm_flags(DWORD flags);
|
||||
void dbg_dump_hook_type(int idHook);
|
||||
char* dbg_d3d9_hr_to_str(HRESULT hr);
|
||||
char* dbg_mes_to_str(int id);
|
||||
void __cdecl dbg_invoke_watson(wchar_t const*, wchar_t const*, wchar_t const*, unsigned int, uintptr_t);
|
||||
|
||||
void __cdecl dbg_invoke_watson(
|
||||
_In_opt_z_ wchar_t const*,
|
||||
_In_opt_z_ wchar_t const*,
|
||||
_In_opt_z_ wchar_t const*,
|
||||
_In_ unsigned int,
|
||||
_In_ uintptr_t);
|
||||
|
||||
extern double g_dbg_frame_time;
|
||||
extern DWORD g_dbg_frame_count;
|
||||
extern LPTOP_LEVEL_EXCEPTION_FILTER g_dbg_exception_filter;
|
||||
extern PVOID g_dbg_exception_handle;
|
||||
|
||||
#if defined(__GNUC__) /* wrap msvc intrinsics onto gcc builtins */
|
||||
#undef _ReturnAddress
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef DELAY_IMPORTS_H
|
||||
#define DELAY_IMPORTS_H
|
||||
|
||||
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
|
||||
#define ThreadQuerySetWin32StartAddress 9
|
||||
|
||||
typedef NTSTATUS(WINAPI* RTLVERIFYVERSIONINFOPROC)(PRTL_OSVERSIONINFOEXW, ULONG, ULONGLONG);
|
||||
typedef const char* (CDECL* WINE_GET_VERSIONPROC)();
|
||||
typedef void (CDECL* WINE_GET_HOST_VERSIONPROC)(const char** sysname, const char** release);
|
||||
typedef NTSTATUS(WINAPI* NTQUERYINFORMATIONTHREADPROC)(HANDLE, LONG, PVOID, ULONG, PULONG);
|
||||
|
||||
typedef ULONGLONG(WINAPI* VERSETCONDITIONMASKPROC)(ULONGLONG, DWORD, BYTE);
|
||||
typedef BOOL(WINAPI* GETMODULEHANDLEEXAPROC)(DWORD, LPCSTR, HMODULE*);
|
||||
|
||||
extern NTQUERYINFORMATIONTHREADPROC delay_NtQueryInformationThread;
|
||||
extern RTLVERIFYVERSIONINFOPROC delay_RtlVerifyVersionInfo;
|
||||
extern WINE_GET_VERSIONPROC delay_wine_get_version;
|
||||
extern WINE_GET_HOST_VERSIONPROC delay_wine_get_host_version;
|
||||
|
||||
extern VERSETCONDITIONMASKPROC delay_VerSetConditionMask;
|
||||
extern GETMODULEHANDLEEXAPROC delay_GetModuleHandleExA;
|
||||
|
||||
void delay_imports_init();
|
||||
|
||||
#endif
|
|
@ -29,8 +29,4 @@ typedef HRESULT(__stdcall* SETPROCESSDPIAWERENESSPROC)(PROCESS_DPI_AWARENESS);
|
|||
typedef BOOL(__stdcall* SETPROCESSDPIAWAREPROC)();
|
||||
typedef BOOL(__stdcall* SETPROCESSDPIAWARENESSCONTEXTPROC)(DPI_AWARENESS_CONTEXT);
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_WINXP)
|
||||
#define SetThreadExecutionState(a)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
24
inc/hook.h
24
inc/hook.h
|
@ -2,12 +2,10 @@
|
|||
#define HOOK_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <vfw.h>
|
||||
|
||||
|
||||
#define HOOK_SKIP_2 0x00000001l
|
||||
#define HOOK_LOCAL_ONLY 0x00000002l
|
||||
#define HOOK_SYSTEM_ONLY 0x00000004l
|
||||
|
||||
typedef struct HOOKLISTDATA {
|
||||
char function_name[32];
|
||||
|
@ -18,7 +16,7 @@ typedef struct HOOKLISTDATA {
|
|||
HMODULE mod;
|
||||
} HOOKLISTDATA;
|
||||
|
||||
typedef struct HOOKLIST { char module_name[32]; HOOKLISTDATA data[39]; } HOOKLIST;
|
||||
typedef struct HOOKLIST { char module_name[32]; HOOKLISTDATA data[34]; } HOOKLIST;
|
||||
|
||||
typedef BOOL(WINAPI* GETCURSORPOSPROC)(LPPOINT);
|
||||
typedef BOOL(WINAPI* CLIPCURSORPROC)(const RECT*);
|
||||
|
@ -37,7 +35,6 @@ typedef BOOL(WINAPI* SETWINDOWPOSPROC)(HWND, HWND, int, int, int, int, UINT);
|
|||
typedef BOOL(WINAPI* MOVEWINDOWPROC)(HWND, int, int, int, int, BOOL);
|
||||
typedef LRESULT(WINAPI* SENDMESSAGEAPROC)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef LONG(WINAPI* SETWINDOWLONGAPROC)(HWND, int, LONG);
|
||||
typedef LONG(WINAPI* SETWINDOWLONGWPROC)(HWND, int, LONG);
|
||||
typedef LONG(WINAPI* GETWINDOWLONGAPROC)(HWND, int);
|
||||
typedef BOOL(WINAPI* ENABLEWINDOWPROC)(HWND, BOOL);
|
||||
typedef HWND(WINAPI* CREATEWINDOWEXAPROC)(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
|
||||
|
@ -60,21 +57,13 @@ typedef HHOOK(WINAPI* SETWINDOWSHOOKEXAPROC)(int, HOOKPROC, HINSTANCE, DWORD);
|
|||
typedef BOOL(WINAPI* PEEKMESSAGEAPROC)(LPMSG, HWND, UINT, UINT, UINT);
|
||||
typedef BOOL(WINAPI* GETMESSAGEAPROC)(LPMSG, HWND, UINT, UINT);
|
||||
typedef BOOL(WINAPI* GETWINDOWPLACEMENTPROC)(HWND, WINDOWPLACEMENT*);
|
||||
typedef BOOL(WINAPI* SETWINDOWPLACEMENTPROC)(HWND, const WINDOWPLACEMENT*);
|
||||
typedef BOOL(WINAPI* ENUMDISPLAYSETTINGSAPROC)(LPCSTR, DWORD, DEVMODEA*);
|
||||
typedef LRESULT(WINAPI* DEFWINDOWPROCAPROC)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef HWND(WINAPI* SETPARENTPROC)(HWND, HWND);
|
||||
typedef HDC (WINAPI* BEGINPAINTPROC)(HWND, LPPAINTSTRUCT);
|
||||
typedef SHORT(WINAPI* GETKEYSTATEPROC)(int);
|
||||
typedef SHORT(WINAPI* GETASYNCKEYSTATEPROC)(int);
|
||||
|
||||
typedef int (WINAPI* GETDEVICECAPSPROC)(HDC, int);
|
||||
typedef HFONT(WINAPI* CREATEFONTINDIRECTAPROC)(CONST LOGFONT*);
|
||||
typedef HFONT(WINAPI* CREATEFONTAPROC)(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
|
||||
typedef UINT(WINAPI* GETSYSTEMPALETTEENTRIESPROC)(HDC, UINT, UINT, LPPALETTEENTRY);
|
||||
typedef HPALETTE(WINAPI* SELECTPALETTEPROC)(HDC, HPALETTE, BOOL);
|
||||
typedef UINT (WINAPI* REALIZEPALETTEPROC)(HDC);
|
||||
|
||||
typedef HMODULE(WINAPI* LOADLIBRARYAPROC)(LPCSTR);
|
||||
typedef HMODULE(WINAPI* LOADLIBRARYWPROC)(LPCWSTR);
|
||||
typedef HMODULE(WINAPI* LOADLIBRARYEXAPROC)(LPCSTR, HANDLE, DWORD);
|
||||
|
@ -87,8 +76,6 @@ typedef HRESULT(WINAPI* COCREATEINSTANCEPROC)(REFCLSID, LPUNKNOWN, DWORD, REFIID
|
|||
typedef MCIERROR(WINAPI* MCISENDCOMMANDAPROC)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
|
||||
typedef LPTOP_LEVEL_EXCEPTION_FILTER(WINAPI* SETUNHANDLEDEXCEPTIONFILTERPROC)(LPTOP_LEVEL_EXCEPTION_FILTER);
|
||||
|
||||
typedef PGETFRAME (WINAPI* AVISTREAMGETFRAMEOPENPROC)(PAVISTREAM, LPBITMAPINFOHEADER);
|
||||
|
||||
extern GETCURSORPOSPROC real_GetCursorPos;
|
||||
extern CLIPCURSORPROC real_ClipCursor;
|
||||
extern SHOWCURSORPROC real_ShowCursor;
|
||||
|
@ -106,7 +93,6 @@ extern SETWINDOWPOSPROC real_SetWindowPos;
|
|||
extern MOVEWINDOWPROC real_MoveWindow;
|
||||
extern SENDMESSAGEAPROC real_SendMessageA;
|
||||
extern SETWINDOWLONGAPROC real_SetWindowLongA;
|
||||
extern SETWINDOWLONGWPROC real_SetWindowLongW;
|
||||
extern GETWINDOWLONGAPROC real_GetWindowLongA;
|
||||
extern ENABLEWINDOWPROC real_EnableWindow;
|
||||
extern CREATEWINDOWEXAPROC real_CreateWindowExA;
|
||||
|
@ -124,19 +110,12 @@ extern SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA;
|
|||
extern PEEKMESSAGEAPROC real_PeekMessageA;
|
||||
extern GETMESSAGEAPROC real_GetMessageA;
|
||||
extern GETWINDOWPLACEMENTPROC real_GetWindowPlacement;
|
||||
extern SETWINDOWPLACEMENTPROC real_SetWindowPlacement;
|
||||
extern ENUMDISPLAYSETTINGSAPROC real_EnumDisplaySettingsA;
|
||||
extern DEFWINDOWPROCAPROC real_DefWindowProcA;
|
||||
extern SETPARENTPROC real_SetParent;
|
||||
extern BEGINPAINTPROC real_BeginPaint;
|
||||
extern GETKEYSTATEPROC real_GetKeyState;
|
||||
extern GETASYNCKEYSTATEPROC real_GetAsyncKeyState;
|
||||
extern GETDEVICECAPSPROC real_GetDeviceCaps;
|
||||
extern CREATEFONTINDIRECTAPROC real_CreateFontIndirectA;
|
||||
extern CREATEFONTAPROC real_CreateFontA;
|
||||
extern GETSYSTEMPALETTEENTRIESPROC real_GetSystemPaletteEntries;
|
||||
extern SELECTPALETTEPROC real_SelectPalette;
|
||||
extern REALIZEPALETTEPROC real_RealizePalette;
|
||||
extern LOADLIBRARYAPROC real_LoadLibraryA;
|
||||
extern LOADLIBRARYWPROC real_LoadLibraryW;
|
||||
extern LOADLIBRARYEXAPROC real_LoadLibraryExA;
|
||||
|
@ -148,7 +127,6 @@ extern GETVERSIONEXAPROC real_GetVersionExA;
|
|||
extern COCREATEINSTANCEPROC real_CoCreateInstance;
|
||||
extern MCISENDCOMMANDAPROC real_mciSendCommandA;
|
||||
extern SETUNHANDLEDEXCEPTIONFILTERPROC real_SetUnhandledExceptionFilter;
|
||||
extern AVISTREAMGETFRAMEOPENPROC real_AVIStreamGetFrameOpen;
|
||||
|
||||
extern BOOL g_hook_active;
|
||||
extern HOOKLIST g_hook_hooklist[];
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef MOUSE_H
|
||||
#define MOUSE_H
|
||||
|
||||
void mouse_hook_init();
|
||||
void mouse_hook_exit();
|
||||
void mouse_lock();
|
||||
void mouse_unlock();
|
||||
LRESULT CALLBACK mouse_hook_proc(int Code, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK mouse_gm_hook_proc(int code, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK mouse_hook_proc(int code, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
extern BOOL g_mouse_locked;
|
||||
extern HHOOK g_mouse_hook;
|
||||
|
|
|
@ -115,6 +115,5 @@ extern HMODULE g_oglu_hmodule;
|
|||
extern BOOL g_oglu_got_version2;
|
||||
extern BOOL g_oglu_got_version3;
|
||||
extern char g_oglu_version[];
|
||||
extern char g_oglu_version_long[];
|
||||
|
||||
#endif
|
||||
|
|
265
inc/palette.h
265
inc/palette.h
|
@ -1,265 +0,0 @@
|
|||
#ifndef PALETTE_H
|
||||
#define PALETTE_H
|
||||
|
||||
// Original palette copied from Windows ME
|
||||
static PALETTEENTRY g_ddp_default_palette[] =
|
||||
{
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 128, 0, 0, 0 },
|
||||
{ 0, 128, 0, 0 },
|
||||
{ 128, 128, 0, 0 },
|
||||
{ 0, 0, 128, 0 },
|
||||
{ 128, 0, 128, 0 },
|
||||
{ 0, 128, 128, 0 },
|
||||
{ 192, 192, 192, 0 },
|
||||
{ 192, 220, 192, 0 },
|
||||
{ 166, 202, 240, 0 },
|
||||
{ 95, 63, 63, 0 },
|
||||
{ 127, 63, 63, 0 },
|
||||
{ 159, 63, 63, 0 },
|
||||
{ 191, 63, 63, 0 },
|
||||
{ 223, 63, 63, 0 },
|
||||
{ 255, 63, 63, 0 },
|
||||
{ 63, 95, 63, 0 },
|
||||
{ 95, 95, 63, 0 },
|
||||
{ 127, 95, 63, 0 },
|
||||
{ 159, 95, 63, 0 },
|
||||
{ 191, 95, 63, 0 },
|
||||
{ 223, 95, 63, 0 },
|
||||
{ 255, 95, 63, 0 },
|
||||
{ 63, 127, 63, 0 },
|
||||
{ 95, 127, 63, 0 },
|
||||
{ 127, 127, 63, 0 },
|
||||
{ 159, 127, 63, 0 },
|
||||
{ 191, 127, 63, 0 },
|
||||
{ 223, 127, 63, 0 },
|
||||
{ 255, 127, 63, 0 },
|
||||
{ 63, 159, 63, 0 },
|
||||
{ 95, 159, 63, 0 },
|
||||
{ 127, 159, 63, 0 },
|
||||
{ 159, 159, 63, 0 },
|
||||
{ 191, 159, 63, 0 },
|
||||
{ 223, 159, 63, 0 },
|
||||
{ 255, 159, 63, 0 },
|
||||
{ 63, 191, 63, 0 },
|
||||
{ 95, 191, 63, 0 },
|
||||
{ 127, 191, 63, 0 },
|
||||
{ 159, 191, 63, 0 },
|
||||
{ 191, 191, 63, 0 },
|
||||
{ 223, 191, 63, 0 },
|
||||
{ 255, 191, 63, 0 },
|
||||
{ 63, 223, 63, 0 },
|
||||
{ 95, 223, 63, 0 },
|
||||
{ 127, 223, 63, 0 },
|
||||
{ 159, 223, 63, 0 },
|
||||
{ 191, 223, 63, 0 },
|
||||
{ 223, 223, 63, 0 },
|
||||
{ 255, 223, 63, 0 },
|
||||
{ 63, 255, 63, 0 },
|
||||
{ 95, 255, 63, 0 },
|
||||
{ 127, 255, 63, 0 },
|
||||
{ 159, 255, 63, 0 },
|
||||
{ 191, 255, 63, 0 },
|
||||
{ 223, 255, 63, 0 },
|
||||
{ 255, 255, 63, 0 },
|
||||
{ 63, 63, 95, 0 },
|
||||
{ 95, 63, 95, 0 },
|
||||
{ 127, 63, 95, 0 },
|
||||
{ 159, 63, 95, 0 },
|
||||
{ 191, 63, 95, 0 },
|
||||
{ 223, 63, 95, 0 },
|
||||
{ 255, 63, 95, 0 },
|
||||
{ 63, 95, 95, 0 },
|
||||
{ 95, 95, 95, 0 },
|
||||
{ 127, 95, 95, 0 },
|
||||
{ 159, 95, 95, 0 },
|
||||
{ 191, 95, 95, 0 },
|
||||
{ 223, 95, 95, 0 },
|
||||
{ 255, 95, 95, 0 },
|
||||
{ 63, 127, 95, 0 },
|
||||
{ 95, 127, 95, 0 },
|
||||
{ 127, 127, 95, 0 },
|
||||
{ 159, 127, 95, 0 },
|
||||
{ 191, 127, 95, 0 },
|
||||
{ 223, 127, 95, 0 },
|
||||
{ 255, 127, 95, 0 },
|
||||
{ 63, 159, 95, 0 },
|
||||
{ 95, 159, 95, 0 },
|
||||
{ 127, 159, 95, 0 },
|
||||
{ 159, 159, 95, 0 },
|
||||
{ 191, 159, 95, 0 },
|
||||
{ 223, 159, 95, 0 },
|
||||
{ 255, 159, 95, 0 },
|
||||
{ 63, 191, 95, 0 },
|
||||
{ 95, 191, 95, 0 },
|
||||
{ 127, 191, 95, 0 },
|
||||
{ 159, 191, 95, 0 },
|
||||
{ 191, 191, 95, 0 },
|
||||
{ 223, 191, 95, 0 },
|
||||
{ 255, 191, 95, 0 },
|
||||
{ 63, 223, 95, 0 },
|
||||
{ 95, 223, 95, 0 },
|
||||
{ 127, 223, 95, 0 },
|
||||
{ 159, 223, 95, 0 },
|
||||
{ 191, 223, 95, 0 },
|
||||
{ 223, 223, 95, 0 },
|
||||
{ 255, 223, 95, 0 },
|
||||
{ 63, 255, 95, 0 },
|
||||
{ 95, 255, 95, 0 },
|
||||
{ 127, 255, 95, 0 },
|
||||
{ 159, 255, 95, 0 },
|
||||
{ 191, 255, 95, 0 },
|
||||
{ 223, 255, 95, 0 },
|
||||
{ 255, 255, 95, 0 },
|
||||
{ 63, 63, 127, 0 },
|
||||
{ 95, 63, 127, 0 },
|
||||
{ 127, 63, 127, 0 },
|
||||
{ 159, 63, 127, 0 },
|
||||
{ 191, 63, 127, 0 },
|
||||
{ 223, 63, 127, 0 },
|
||||
{ 255, 63, 127, 0 },
|
||||
{ 63, 95, 127, 0 },
|
||||
{ 95, 95, 127, 0 },
|
||||
{ 127, 95, 127, 0 },
|
||||
{ 159, 95, 127, 0 },
|
||||
{ 191, 95, 127, 0 },
|
||||
{ 223, 95, 127, 0 },
|
||||
{ 255, 95, 127, 0 },
|
||||
{ 63, 127, 127, 0 },
|
||||
{ 95, 127, 127, 0 },
|
||||
{ 127, 127, 127, 0 },
|
||||
{ 159, 127, 127, 0 },
|
||||
{ 191, 127, 127, 0 },
|
||||
{ 223, 127, 127, 0 },
|
||||
{ 255, 127, 127, 0 },
|
||||
{ 63, 159, 127, 0 },
|
||||
{ 95, 159, 127, 0 },
|
||||
{ 127, 159, 127, 0 },
|
||||
{ 159, 159, 127, 0 },
|
||||
{ 191, 159, 127, 0 },
|
||||
{ 223, 159, 127, 0 },
|
||||
{ 255, 159, 127, 0 },
|
||||
{ 63, 191, 127, 0 },
|
||||
{ 95, 191, 127, 0 },
|
||||
{ 127, 191, 127, 0 },
|
||||
{ 159, 191, 127, 0 },
|
||||
{ 191, 191, 127, 0 },
|
||||
{ 223, 191, 127, 0 },
|
||||
{ 255, 191, 127, 0 },
|
||||
{ 63, 223, 127, 0 },
|
||||
{ 95, 223, 127, 0 },
|
||||
{ 127, 223, 127, 0 },
|
||||
{ 159, 223, 127, 0 },
|
||||
{ 191, 223, 127, 0 },
|
||||
{ 223, 223, 127, 0 },
|
||||
{ 255, 223, 127, 0 },
|
||||
{ 63, 255, 127, 0 },
|
||||
{ 95, 255, 127, 0 },
|
||||
{ 127, 255, 127, 0 },
|
||||
{ 159, 255, 127, 0 },
|
||||
{ 191, 255, 127, 0 },
|
||||
{ 223, 255, 127, 0 },
|
||||
{ 255, 255, 127, 0 },
|
||||
{ 63, 63, 159, 0 },
|
||||
{ 95, 63, 159, 0 },
|
||||
{ 127, 63, 159, 0 },
|
||||
{ 159, 63, 159, 0 },
|
||||
{ 191, 63, 159, 0 },
|
||||
{ 223, 63, 159, 0 },
|
||||
{ 255, 63, 159, 0 },
|
||||
{ 63, 95, 159, 0 },
|
||||
{ 95, 95, 159, 0 },
|
||||
{ 127, 95, 159, 0 },
|
||||
{ 159, 95, 159, 0 },
|
||||
{ 191, 95, 159, 0 },
|
||||
{ 223, 95, 159, 0 },
|
||||
{ 255, 95, 159, 0 },
|
||||
{ 63, 127, 159, 0 },
|
||||
{ 95, 127, 159, 0 },
|
||||
{ 127, 127, 159, 0 },
|
||||
{ 159, 127, 159, 0 },
|
||||
{ 191, 127, 159, 0 },
|
||||
{ 223, 127, 159, 0 },
|
||||
{ 255, 127, 159, 0 },
|
||||
{ 63, 159, 159, 0 },
|
||||
{ 95, 159, 159, 0 },
|
||||
{ 127, 159, 159, 0 },
|
||||
{ 159, 159, 159, 0 },
|
||||
{ 191, 159, 159, 0 },
|
||||
{ 223, 159, 159, 0 },
|
||||
{ 255, 159, 159, 0 },
|
||||
{ 63, 191, 159, 0 },
|
||||
{ 95, 191, 159, 0 },
|
||||
{ 127, 191, 159, 0 },
|
||||
{ 159, 191, 159, 0 },
|
||||
{ 191, 191, 159, 0 },
|
||||
{ 223, 191, 159, 0 },
|
||||
{ 255, 191, 159, 0 },
|
||||
{ 63, 223, 159, 0 },
|
||||
{ 95, 223, 159, 0 },
|
||||
{ 127, 223, 159, 0 },
|
||||
{ 159, 223, 159, 0 },
|
||||
{ 191, 223, 159, 0 },
|
||||
{ 223, 223, 159, 0 },
|
||||
{ 255, 223, 159, 0 },
|
||||
{ 63, 255, 159, 0 },
|
||||
{ 95, 255, 159, 0 },
|
||||
{ 127, 255, 159, 0 },
|
||||
{ 159, 255, 159, 0 },
|
||||
{ 191, 255, 159, 0 },
|
||||
{ 223, 255, 159, 0 },
|
||||
{ 255, 255, 159, 0 },
|
||||
{ 63, 63, 191, 0 },
|
||||
{ 95, 63, 191, 0 },
|
||||
{ 127, 63, 191, 0 },
|
||||
{ 159, 63, 191, 0 },
|
||||
{ 191, 63, 191, 0 },
|
||||
{ 223, 63, 191, 0 },
|
||||
{ 255, 63, 191, 0 },
|
||||
{ 63, 95, 191, 0 },
|
||||
{ 95, 95, 191, 0 },
|
||||
{ 127, 95, 191, 0 },
|
||||
{ 159, 95, 191, 0 },
|
||||
{ 191, 95, 191, 0 },
|
||||
{ 223, 95, 191, 0 },
|
||||
{ 255, 95, 191, 0 },
|
||||
{ 63, 127, 191, 0 },
|
||||
{ 95, 127, 191, 0 },
|
||||
{ 127, 127, 191, 0 },
|
||||
{ 159, 127, 191, 0 },
|
||||
{ 191, 127, 191, 0 },
|
||||
{ 223, 127, 191, 0 },
|
||||
{ 255, 127, 191, 0 },
|
||||
{ 63, 159, 191, 0 },
|
||||
{ 95, 159, 191, 0 },
|
||||
{ 127, 159, 191, 0 },
|
||||
{ 159, 159, 191, 0 },
|
||||
{ 191, 159, 191, 0 },
|
||||
{ 223, 159, 191, 0 },
|
||||
{ 255, 159, 191, 0 },
|
||||
{ 63, 191, 191, 0 },
|
||||
{ 95, 191, 191, 0 },
|
||||
{ 127, 191, 191, 0 },
|
||||
{ 159, 191, 191, 0 },
|
||||
{ 191, 191, 191, 0 },
|
||||
{ 223, 191, 191, 0 },
|
||||
{ 255, 191, 191, 0 },
|
||||
{ 63, 223, 191, 0 },
|
||||
{ 95, 223, 191, 0 },
|
||||
{ 127, 223, 191, 0 },
|
||||
{ 159, 223, 191, 0 },
|
||||
{ 191, 223, 191, 0 },
|
||||
{ 223, 223, 191, 0 },
|
||||
{ 255, 251, 240, 0 },
|
||||
{ 58, 109, 165, 0 },
|
||||
{ 128, 128, 128, 0 },
|
||||
{ 255, 0, 0, 0 },
|
||||
{ 0, 255, 0, 0 },
|
||||
{ 255, 255, 0, 0 },
|
||||
{ 0, 0, 255, 0 },
|
||||
{ 255, 0, 255, 0 },
|
||||
{ 0, 255, 255, 0 },
|
||||
{ 255, 255, 255, 0 }
|
||||
};
|
||||
|
||||
#endif
|
|
@ -6,10 +6,6 @@
|
|||
|
||||
|
||||
HMODULE WINAPI util_enumerate_modules(_In_opt_ HMODULE hModuleLast);
|
||||
void util_set_process_affinity();
|
||||
void util_set_thread_affinity(DWORD tid);
|
||||
void util_pull_messages();
|
||||
DWORD util_get_timestamp(HMODULE mod);
|
||||
FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name);
|
||||
BOOL util_caller_is_ddraw_wrapper(void* return_address);
|
||||
BOOL util_is_bad_read_ptr(void* p);
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
|
||||
#define str(s) #s
|
||||
#define ver_str(a,b,c,d) str(a) "." str(b) "." str(c) "." str(d)
|
||||
#define git_str(a) str(a)
|
||||
|
||||
#define VERSION_MAJOR 7
|
||||
#define VERSION_MINOR 1
|
||||
#define VERSION_MAJOR 6
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_BUILD 0
|
||||
#define VERSION_REVISION 1
|
||||
#define VERSION_REVISION 3
|
||||
|
||||
#define VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION
|
||||
#define VERSION_STRING ver_str(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION)
|
||||
|
|
|
@ -28,13 +28,9 @@
|
|||
#define _WIN32_WINNT_WIN11 0x0A00
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
||||
#define VerifyVersionInfoW(a,b,c) 0
|
||||
#define VerSetConditionMask verhelp_set_mask
|
||||
#endif
|
||||
|
||||
void verhelp_init();
|
||||
BOOL verhelp_verify_version(PRTL_OSVERSIONINFOEXW versionInfo, ULONG typeMask, ULONGLONG conditionMask);
|
||||
ULONGLONG verhelp_set_mask(ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition);
|
||||
const char* verhelp_wine_get_version();
|
||||
void verhelp_wine_get_host_version(const char** sysname, const char** release);
|
||||
|
||||
|
@ -60,17 +56,6 @@ VERSIONHELPERAPI IsWindowsVersion(DWORD major, DWORD minor, DWORD build, WORD se
|
|||
VER_SERVICEPACKMAJOR, VER_EQUAL));
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindowsVersionExcactBuild(DWORD major, DWORD minor, DWORD build, WORD servpack)
|
||||
{
|
||||
RTL_OSVERSIONINFOEXW vi = { sizeof(vi),major,minor,build,0,{0},servpack };
|
||||
return verhelp_verify_version(&vi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER | VER_SERVICEPACKMAJOR,
|
||||
VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0,
|
||||
VER_MAJORVERSION, VER_EQUAL),
|
||||
VER_MINORVERSION, VER_EQUAL),
|
||||
VER_BUILDNUMBER, VER_EQUAL),
|
||||
VER_SERVICEPACKMAJOR, VER_EQUAL));
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindowsVersionAnySP(DWORD major, DWORD minor, DWORD build)
|
||||
{
|
||||
RTL_OSVERSIONINFOEXW vi = { sizeof(vi),major,minor,build,0,{0},0 };
|
||||
|
@ -82,10 +67,6 @@ VERSIONHELPERAPI IsWindowsVersionAnySP(DWORD major, DWORD minor, DWORD build)
|
|||
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL));
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindows2000OrGreater(void) {
|
||||
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN2K), LOBYTE(_WIN32_WINNT_WIN2K), 0, 0);
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindowsXPOrGreater(void) {
|
||||
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0, 0);
|
||||
}
|
||||
|
@ -146,19 +127,11 @@ VERSIONHELPERAPI IsWindows11OrGreater(void) {
|
|||
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 22000, 0);
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindows11Version24H2OrGreater(void) {
|
||||
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 26100, 0);
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindowsServer(void) {
|
||||
OSVERSIONINFOEXW vi = {sizeof(vi),0,0,0,0,{0},0,0,0,VER_NT_WORKSTATION};
|
||||
return !verhelp_verify_version(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL));
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindows2000(void) {
|
||||
return IsWindowsVersionAnySP(HIBYTE(_WIN32_WINNT_WIN2K), LOBYTE(_WIN32_WINNT_WIN2K), 0);
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindowsXP(void) {
|
||||
return IsWindowsVersionAnySP(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
|
||||
}
|
||||
|
@ -227,10 +200,6 @@ VERSIONHELPERAPI IsWindows11(void) {
|
|||
return IsWindowsVersion(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 22000, 0);
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWindows11Version24H2(void) {
|
||||
return IsWindowsVersionExcactBuild(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 26100, 0);
|
||||
}
|
||||
|
||||
VERSIONHELPERAPI IsWine(void) {
|
||||
return verhelp_wine_get_version() != NULL;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define WINAPI_HOOKS_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <vfw.h>
|
||||
|
||||
|
||||
BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint);
|
||||
|
@ -22,7 +21,6 @@ BOOL WINAPI fake_SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int
|
|||
BOOL WINAPI fake_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint);
|
||||
LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
LONG WINAPI fake_SetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
LONG WINAPI fake_SetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
LONG WINAPI fake_GetWindowLongA(HWND hWnd, int nIndex);
|
||||
BOOL WINAPI fake_EnableWindow(HWND hWnd, BOOL bEnable);
|
||||
BOOL WINAPI fake_DestroyWindow(HWND hWnd);
|
||||
|
@ -35,15 +33,10 @@ HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, D
|
|||
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg);
|
||||
BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
|
||||
BOOL WINAPI fake_GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT* lpwndpl);
|
||||
BOOL WINAPI fake_SetWindowPlacement(HWND hWnd, const WINDOWPLACEMENT* lpwndpl);
|
||||
BOOL WINAPI fake_EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, DEVMODEA* lpDevMode);
|
||||
LRESULT WINAPI fake_DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
HWND WINAPI fake_SetParent(HWND hWndChild, HWND hWndNewParent);
|
||||
HDC WINAPI fake_BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint);
|
||||
SHORT WINAPI fake_GetKeyState(int nVirtKey);
|
||||
SHORT WINAPI fake_GetAsyncKeyState(int vKey);
|
||||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index);
|
||||
int WINAPI fake_GetDeviceCaps_system(HDC hdc, int index);
|
||||
|
||||
BOOL WINAPI fake_StretchBlt(
|
||||
HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
||||
|
@ -65,9 +58,6 @@ int WINAPI fake_StretchDIBits(
|
|||
|
||||
HFONT WINAPI fake_CreateFontIndirectA(CONST LOGFONTA*);
|
||||
HFONT WINAPI fake_CreateFontA(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
|
||||
UINT WINAPI fake_GetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY);
|
||||
HPALETTE WINAPI fake_SelectPalette(HDC, HPALETTE, BOOL);
|
||||
UINT WINAPI fake_RealizePalette(HDC);
|
||||
|
||||
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName);
|
||||
HMODULE WINAPI fake_LoadLibraryW(LPCWSTR lpLibFileName);
|
||||
|
@ -97,6 +87,4 @@ MCIERROR WINAPI fake_mciSendCommandA(MCIDEVICEID IDDevice, UINT uMsg, DWORD_PTR
|
|||
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI fake_SetUnhandledExceptionFilter(
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
|
||||
|
||||
PGETFRAME WINAPI fake_AVIStreamGetFrameOpen(PAVISTREAM pavi, LPBITMAPINFOHEADER lpbiWanted);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,15 +12,10 @@
|
|||
#define WM_RESTORE_STYLE WM_APP+119
|
||||
|
||||
#define IDT_TIMER_LEAVE_BNET 541287654
|
||||
#define IDT_TIMER_LINUX_FIX_WINDOW_SIZE 345267753
|
||||
|
||||
#define CNC_DDRAW_SET_FULLSCREEN 1
|
||||
#define CNC_DDRAW_SET_WINDOWED 2
|
||||
|
||||
#ifndef WM_UNICHAR
|
||||
#define WM_UNICHAR 0x0109
|
||||
#endif
|
||||
|
||||
LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,11 +14,6 @@ HRESULT __stdcall IDirect3D__QueryInterface(IDirect3DImpl* This, REFIID riid, vo
|
|||
|
||||
HRESULT ret = E_FAIL;
|
||||
|
||||
if (riid)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED GUID = %08X\n", ((GUID*)riid)->Data1);
|
||||
}
|
||||
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
@ -56,20 +51,10 @@ HRESULT __stdcall IDirect3D__Initialize(IDirect3DImpl* This, int a)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall IDirect3D__EnumDevices(
|
||||
IDirect3DImpl* This,
|
||||
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
|
||||
LPVOID lpUserArg)
|
||||
HRESULT __stdcall IDirect3D__EnumDevices(IDirect3DImpl* This, int a, int b)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
|
||||
HRESULT ret = S_OK;
|
||||
|
||||
if (lpEnumDevicesCallback)
|
||||
{
|
||||
D3DDEVICEDESC desc = { 0 };
|
||||
lpEnumDevicesCallback((GUID FAR*)&GUID_NULL, "NULL", "NULL", &desc, &desc, lpUserArg);
|
||||
}
|
||||
|
||||
HRESULT ret = E_FAIL;
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ HRESULT __stdcall IDirect3D2__QueryInterface(IDirect3D2Impl* This, REFIID riid,
|
|||
|
||||
HRESULT ret = E_FAIL;
|
||||
|
||||
if (riid)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED GUID = %08X\n", ((GUID*)riid)->Data1);
|
||||
}
|
||||
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
@ -48,20 +43,10 @@ ULONG __stdcall IDirect3D2__Release(IDirect3D2Impl* This)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall IDirect3D2__EnumDevices(
|
||||
IDirect3D2Impl* This,
|
||||
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
|
||||
LPVOID lpUserArg)
|
||||
HRESULT __stdcall IDirect3D2__EnumDevices(IDirect3D2Impl* This, int a, int b)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
|
||||
HRESULT ret = S_OK;
|
||||
|
||||
if (lpEnumDevicesCallback)
|
||||
{
|
||||
//D3DDEVICEDESC desc = { 0 };
|
||||
//lpEnumDevicesCallback((GUID FAR*)&GUID_NULL, "NULL", "NULL", &desc, &desc, lpUserArg);
|
||||
}
|
||||
|
||||
HRESULT ret = E_FAIL;
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ HRESULT __stdcall IDirect3D3__QueryInterface(IDirect3D3Impl* This, REFIID riid,
|
|||
|
||||
HRESULT ret = E_FAIL;
|
||||
|
||||
if (riid)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED GUID = %08X\n", ((GUID*)riid)->Data1);
|
||||
}
|
||||
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
@ -48,20 +43,10 @@ ULONG __stdcall IDirect3D3__Release(IDirect3D3Impl* This)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall IDirect3D3__EnumDevices(
|
||||
IDirect3D3Impl* This,
|
||||
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
|
||||
LPVOID lpUserArg)
|
||||
HRESULT __stdcall IDirect3D3__EnumDevices(IDirect3D3Impl* This, int a, int b)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
|
||||
HRESULT ret = S_OK;
|
||||
|
||||
if (lpEnumDevicesCallback)
|
||||
{
|
||||
//D3DDEVICEDESC desc = { 0 };
|
||||
//lpEnumDevicesCallback((GUID FAR*)&GUID_NULL, "NULL", "NULL", &desc, &desc, lpUserArg);
|
||||
}
|
||||
|
||||
HRESULT ret = E_FAIL;
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ HRESULT __stdcall IDirect3D7__QueryInterface(IDirect3D7Impl* This, REFIID riid,
|
|||
|
||||
HRESULT ret = E_FAIL;
|
||||
|
||||
if (riid)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED GUID = %08X\n", ((GUID*)riid)->Data1);
|
||||
}
|
||||
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
@ -48,20 +43,10 @@ ULONG __stdcall IDirect3D7__Release(IDirect3D7Impl* This)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall IDirect3D7__EnumDevices(
|
||||
IDirect3D7Impl* This,
|
||||
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
|
||||
LPVOID lpUserArg)
|
||||
HRESULT __stdcall IDirect3D7__EnumDevices(IDirect3D7Impl* This, int a, int b)
|
||||
{
|
||||
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
|
||||
HRESULT ret = S_OK;
|
||||
|
||||
if (lpEnumDevicesCallback)
|
||||
{
|
||||
//D3DDEVICEDESC7 desc = { 0 };
|
||||
//lpEnumDevicesCallback("NULL", "NULL", &desc, lpUserArg);
|
||||
}
|
||||
|
||||
HRESULT ret = E_FAIL;
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ HRESULT __stdcall IDirectDraw__QueryInterface(IDirectDrawImpl* This, REFIID riid
|
|||
|
||||
ret = S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(&IID_IDirect3D, riid))
|
||||
else if (IsEqualGUID(&IID_IDirect3D, riid) && !g_config.direct3d_passthrough)
|
||||
{
|
||||
IDirect3DImpl* d3d =
|
||||
(IDirect3DImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DImpl));
|
||||
|
@ -70,7 +70,7 @@ HRESULT __stdcall IDirectDraw__QueryInterface(IDirectDrawImpl* This, REFIID riid
|
|||
|
||||
ret = S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(&IID_IDirect3D2, riid))
|
||||
else if (IsEqualGUID(&IID_IDirect3D2, riid) && !g_config.direct3d_passthrough)
|
||||
{
|
||||
IDirect3D2Impl* d3d =
|
||||
(IDirect3D2Impl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D2Impl));
|
||||
|
@ -84,7 +84,7 @@ HRESULT __stdcall IDirectDraw__QueryInterface(IDirectDrawImpl* This, REFIID riid
|
|||
|
||||
ret = S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(&IID_IDirect3D3, riid))
|
||||
else if (IsEqualGUID(&IID_IDirect3D3, riid) && !g_config.direct3d_passthrough)
|
||||
{
|
||||
IDirect3D3Impl* d3d =
|
||||
(IDirect3D3Impl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D3Impl));
|
||||
|
@ -98,7 +98,7 @@ HRESULT __stdcall IDirectDraw__QueryInterface(IDirectDrawImpl* This, REFIID riid
|
|||
|
||||
ret = S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(&IID_IDirect3D7, riid))
|
||||
else if (IsEqualGUID(&IID_IDirect3D7, riid) && !g_config.direct3d_passthrough)
|
||||
{
|
||||
IDirect3D7Impl* d3d =
|
||||
(IDirect3D7Impl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D7Impl));
|
||||
|
@ -328,18 +328,8 @@ HRESULT __stdcall IDirectDraw__EnumSurfaces(
|
|||
LPVOID lpContext,
|
||||
LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback)
|
||||
{
|
||||
TRACE(
|
||||
"NOT_IMPLEMENTED -> %s(This=%p, dwFlags=%08X, lpDDSurfaceDesc=%p, lpContext=%p, lpEnumSurfacesCallback=%p) [%p]\n",
|
||||
__FUNCTION__,
|
||||
This,
|
||||
dwFlags,
|
||||
lpDDSurfaceDesc,
|
||||
lpContext,
|
||||
lpEnumSurfacesCallback,
|
||||
_ReturnAddress());
|
||||
|
||||
TRACE("NOT_IMPLEMENTED -> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
|
||||
HRESULT ret = DD_OK;
|
||||
|
||||
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ HRESULT __stdcall IDirectDrawSurface__GetDC(IDirectDrawSurfaceImpl* This, HDC FA
|
|||
|
||||
HRESULT __stdcall IDirectDrawSurface__GetFlipStatus(IDirectDrawSurfaceImpl* This, DWORD dwFlags)
|
||||
{
|
||||
TRACE_EXT("-> %s(This=%p, dwFlags=%08X) [%p]\n", __FUNCTION__, This, dwFlags, _ReturnAddress());
|
||||
TRACE_EXT("-> %s(This=%p) [%p]\n", __FUNCTION__, This, _ReturnAddress());
|
||||
HRESULT ret = DD_OK;
|
||||
TRACE_EXT("<- %s\n", __FUNCTION__);
|
||||
return ret;
|
||||
|
|
|
@ -518,7 +518,7 @@ void blt_colorfill(
|
|||
if (bpp == 8 ||
|
||||
(bpp == 16 &&
|
||||
(color & 0xFF) == ((color >> 8) & 0xFF)) ||
|
||||
((bpp == 32 || bpp == 24) &&
|
||||
(bpp == 32 &&
|
||||
(color & 0xFF) == ((color >> 8) & 0xFF) &&
|
||||
(color & 0xFF) == ((color >> 16) & 0xFF) &&
|
||||
(color & 0xFF) == ((color >> 24) & 0xFF)))
|
||||
|
|
517
src/config.c
517
src/config.c
|
@ -52,10 +52,6 @@ void cfg_load()
|
|||
GET_INT(g_config.save_settings, "savesettings", 1);
|
||||
GET_BOOL(g_config.resizable, "resizable", TRUE);
|
||||
GET_INT(g_config.d3d9_filter, "d3d9_filter", FILTER_CUBIC);
|
||||
GET_INT(g_config.anti_aliased_fonts_min_size, "anti_aliased_fonts_min_size", 13);
|
||||
GET_INT(g_config.min_font_size, "min_font_size", 0);
|
||||
GET_INT(g_config.center_window, "center_window", CENTER_WINDOW_AUTO);
|
||||
GET_STRING("inject_resolution", "", g_config.inject_resolution, sizeof(g_config.inject_resolution));
|
||||
GET_BOOL(g_config.vhack, "vhack", FALSE);
|
||||
GET_STRING("screenshotdir", ".\\Screenshots\\", g_config.screenshot_dir, sizeof(g_config.screenshot_dir));
|
||||
GET_BOOL(g_config.toggle_borderless, "toggle_borderless", FALSE);
|
||||
|
@ -71,36 +67,37 @@ void cfg_load()
|
|||
GET_BOOL(g_config.singlecpu, "singlecpu", TRUE);
|
||||
GET_INT(g_config.resolutions, "resolutions", RESLIST_NORMAL);
|
||||
GET_INT(g_config.fixchilds, "fixchilds", FIX_CHILDS_DETECT_PAINT);
|
||||
GET_BOOL(g_config.hook_peekmessage, "hook_peekmessage", FALSE);
|
||||
GET_STRING("win_version", "", g_config.win_version, sizeof(g_config.win_version));
|
||||
|
||||
/* Undocumented settings */
|
||||
|
||||
GET_BOOL(g_config.fix_alt_key_stuck, "fix_alt_key_stuck", FALSE);
|
||||
GET_BOOL(g_config.releasealt, "releasealt", FALSE);
|
||||
GET_BOOL(GameHandlesClose, "game_handles_close", FALSE);
|
||||
GET_BOOL(g_config.fix_not_responding, "fix_not_responding", FALSE);
|
||||
GET_BOOL(g_config.no_compat_warning, "no_compat_warning", FALSE);
|
||||
GET_BOOL(g_config.fixnotresponding, "fixnotresponding", FALSE);
|
||||
GET_INT(g_config.hook, "hook", 4);
|
||||
GET_INT(g_config.guard_lines, "guard_lines", 200);
|
||||
GET_INT(g_config.max_resolutions, "max_resolutions", 0);
|
||||
GET_BOOL(g_config.lock_surfaces, "lock_surfaces", FALSE);
|
||||
GET_BOOL(g_config.flipclear, "flipclear", FALSE);
|
||||
GET_BOOL(g_config.fixmousehook, "fixmousehook", FALSE);
|
||||
GET_BOOL(g_config.rgb555, "rgb555", FALSE);
|
||||
GET_BOOL(g_config.no_dinput_hook, "no_dinput_hook", FALSE);
|
||||
GET_INT(g_config.refresh_rate, "refresh_rate", 0);
|
||||
GET_INT(g_config.anti_aliased_fonts_min_size, "anti_aliased_fonts_min_size", 13);
|
||||
GET_STRING("inject_resolution", "", g_config.inject_resolution, sizeof(g_config.inject_resolution));
|
||||
GET_INT(g_config.min_font_size, "min_font_size", 0);
|
||||
GET_BOOL(g_config.direct3d_passthrough, "direct3d_passthrough", FALSE);
|
||||
GET_BOOL(g_config.center_cursor_fix, "center_cursor_fix", FALSE);
|
||||
GET_STRING("fake_mode", "", g_config.fake_mode, sizeof(g_config.fake_mode));
|
||||
GET_BOOL(g_config.wine_allow_resize, "wine_allow_resize", FALSE);
|
||||
GET_BOOL(g_config.lock_mouse_top_left, "lock_mouse_top_left", FALSE);
|
||||
GET_STRING("win_version", "", g_config.win_version, sizeof(g_config.win_version));
|
||||
GET_INT(g_config.hook, "hook", 4);
|
||||
GET_BOOL(g_config.limit_gdi_handles, "limit_gdi_handles", FALSE);
|
||||
GET_BOOL(g_config.no_compat_warning, "no_compat_warning", FALSE);
|
||||
GET_BOOL(g_config.remove_menu, "remove_menu", FALSE);
|
||||
GET_INT(g_config.refresh_rate, "refresh_rate", 0);
|
||||
GET_BOOL(g_config.terminate_process, "terminate_process", FALSE);
|
||||
|
||||
/* Hotkeys */
|
||||
|
||||
GET_INT(g_config.hotkeys.toggle_fullscreen, "keytogglefullscreen", VK_RETURN);
|
||||
GET_INT(g_config.hotkeys.toggle_fullscreen2, "keytogglefullscreen2", 0);
|
||||
GET_INT(g_config.hotkeys.toggle_maximize, "keytogglemaximize", VK_NEXT);
|
||||
GET_INT(g_config.hotkeys.toggle_maximize2, "keytogglemaximize2", 0);
|
||||
GET_INT(g_config.hotkeys.unlock_cursor1, "keyunlockcursor1", VK_TAB);
|
||||
GET_INT(g_config.hotkeys.unlock_cursor2, "keyunlockcursor2", VK_RCONTROL);
|
||||
GET_INT(g_config.hotkeys.screenshot, "keyscreenshot", VK_SNAPSHOT);
|
||||
|
@ -113,11 +110,9 @@ void cfg_load()
|
|||
GET_BOOL(g_config.stronghold_hack, "stronghold_hack", FALSE);
|
||||
GET_BOOL(g_config.mgs_hack, "mgs_hack", FALSE);
|
||||
GET_BOOL(g_config.tlc_hack, "tlc_hack", FALSE);
|
||||
GET_BOOL(g_config.homm_hack, "homm_hack", FALSE);
|
||||
GET_BOOL(g_config.carma95_hack, "carma95_hack", FALSE);
|
||||
GET_BOOL(g_config.sirtech_hack, "sirtech_hack", FALSE);
|
||||
GET_BOOL(g_config.flightsim98_hack, "flightsim98_hack", FALSE);
|
||||
GET_BOOL(g_config.darkcolony_hack, "darkcolony_hack", FALSE);
|
||||
|
||||
|
||||
GameHandlesClose = GameHandlesClose || g_config.infantryhack;
|
||||
|
||||
if (g_config.lock_mouse_top_left)
|
||||
|
@ -134,10 +129,6 @@ void cfg_save()
|
|||
if (!g_config.save_settings)
|
||||
return;
|
||||
|
||||
/* Do not save settings while macOS maximize is active */
|
||||
if (IsMacOS() && !g_config.window_rect.left && !g_config.window_rect.top)
|
||||
return;
|
||||
|
||||
char buf[16];
|
||||
char* section = g_config.save_settings == 1 ? "ddraw" : g_config.process_file_name;
|
||||
|
||||
|
@ -257,14 +248,6 @@ static void cfg_create_ini()
|
|||
"; Raise the size of small fonts to X\n"
|
||||
"min_font_size=0\n"
|
||||
"\n"
|
||||
"; Center window to screen when game changes the display resolution\n"
|
||||
"; Possible values: 0 = never center, 1 = automatic, 2 = always center\n"
|
||||
"center_window=1\n"
|
||||
"\n"
|
||||
"; Inject a custom display resolution into the in-game resolution list - Example values: 960x540, 3840x2160\n"
|
||||
"; Note: This setting can used for downscaling as well, you can insert resolutions higher than your monitor supports\n"
|
||||
"inject_resolution=\n"
|
||||
"\n"
|
||||
"; Enable upscale hack for high resolution patches (Supports C&C1, Red Alert 1, Worms 2 and KKND Xtreme)\n"
|
||||
"vhack=false\n"
|
||||
"\n"
|
||||
|
@ -291,7 +274,7 @@ static void cfg_create_ini()
|
|||
"; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed)\n"
|
||||
"maxgameticks=0\n"
|
||||
"\n"
|
||||
"; Method that should be used to limit game ticks (maxgameticks=): 0 = Automatic, 1 = TestCooperativeLevel, 2 = BltFast, 3 = Unlock, 4 = PeekMessage\n"
|
||||
"; Method that should be used to limit game ticks (maxgameticks=): 0 = Automatic, 1 = TestCooperativeLevel, 2 = BltFast, 3 = Unlock\n"
|
||||
"limiter_type=0\n"
|
||||
"\n"
|
||||
"; Force minimum FPS, possible values: 0 = disabled, -1 = use 'maxfps=' value, -2 = same as -1 but force full redraw, 1-1000 = custom FPS\n"
|
||||
|
@ -306,7 +289,7 @@ static void cfg_create_ini()
|
|||
"; Note: Disable this if the game is not running smooth or there are sound issues\n"
|
||||
"singlecpu=true\n"
|
||||
"\n"
|
||||
"; Available display resolutions, possible values: 0 = Small list, 1 = Very small list, 2 = Full list\n"
|
||||
"; Available resolutions, possible values: 0 = Small list, 1 = Very small list, 2 = Full list\n"
|
||||
"; Note: Set this to 2 if your chosen resolution is not working or does not show up in the list\n"
|
||||
"; Note: Set this to 1 if the game is crashing on startup\n"
|
||||
"resolutions=0\n"
|
||||
|
@ -315,30 +298,29 @@ static void cfg_create_ini()
|
|||
"; Note: Disables upscaling if a child window was detected (to ensure the game is fully playable, may look weird though)\n"
|
||||
"fixchilds=2\n"
|
||||
"\n"
|
||||
"; Enable the following setting if your cursor doesn't lock to the window or it doesn't work properly when upscaling is enabled\n"
|
||||
"hook_peekmessage=false\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"; Undocumented compatibility settings - These will probably not solve your problem, you should rather focus on the settings above\n"
|
||||
"fix_alt_key_stuck=false\n"
|
||||
"; Undocumented settings - You may or may not change these (You should rather focus on the settings above)\n"
|
||||
"releasealt=false\n"
|
||||
"game_handles_close=false\n"
|
||||
"fix_not_responding=false\n"
|
||||
"no_compat_warning=false\n"
|
||||
"fixnotresponding=false\n"
|
||||
"hook=4\n"
|
||||
"guard_lines=200\n"
|
||||
"max_resolutions=0\n"
|
||||
"lock_surfaces=false\n"
|
||||
"flipclear=false\n"
|
||||
"fixmousehook=false\n"
|
||||
"rgb555=false\n"
|
||||
"no_dinput_hook=false\n"
|
||||
"refresh_rate=0\n"
|
||||
";inject_resolution=960x540\n"
|
||||
"direct3d_passthrough=false\n"
|
||||
"center_cursor_fix=false\n"
|
||||
";fake_mode=640x480x32\n"
|
||||
"wine_allow_resize=false\n"
|
||||
"lock_mouse_top_left=false\n"
|
||||
";win_version=95\n"
|
||||
"hook=4\n"
|
||||
"limit_gdi_handles=false\n"
|
||||
"no_compat_warning=false\n"
|
||||
"remove_menu=false\n"
|
||||
"refresh_rate=0\n"
|
||||
"terminate_process=false\n"
|
||||
";win_version=95\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
|
@ -350,15 +332,9 @@ static void cfg_create_ini()
|
|||
"; Switch between windowed and fullscreen mode = [Alt] + ???\n"
|
||||
"keytogglefullscreen=0x0D\n"
|
||||
"\n"
|
||||
"; Switch between windowed and fullscreen mode (single key) = ???\n"
|
||||
"keytogglefullscreen2=0x00\n"
|
||||
"\n"
|
||||
"; Maximize window = [Alt] + ???\n"
|
||||
"keytogglemaximize=0x22\n"
|
||||
"\n"
|
||||
"; Maximize window (single key) = ???\n"
|
||||
"keytogglemaximize2=0x00\n"
|
||||
"\n"
|
||||
"; Unlock cursor 1 = [Ctrl] + ???\n"
|
||||
"keyunlockcursor1=0x09\n"
|
||||
"\n"
|
||||
|
@ -374,7 +350,7 @@ static void cfg_create_ini()
|
|||
"; The following settings are for cnc-ddraw config.exe\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french, italian, vietnamese, polish\n"
|
||||
"; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french, italian, vietnamese\n"
|
||||
"configlang=auto\n"
|
||||
"\n"
|
||||
"; cnc-ddraw config program theme, possible values: Windows10, Cobalt XEMedia\n"
|
||||
|
@ -392,24 +368,10 @@ static void cfg_create_ini()
|
|||
"; The following settings override all settings shown above, section name = executable name\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"; 101: The Airborne Invasion of Normandy\n"
|
||||
"[101]\n"
|
||||
"terminate_process=true\n"
|
||||
"\n"
|
||||
"; 7th Legion\n"
|
||||
"[legion]\n"
|
||||
"maxgameticks=25\n"
|
||||
"\n"
|
||||
"; Atrox\n"
|
||||
"[Atrox]\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
"; Arcatera the Dark Brotherhood\n"
|
||||
"[darksun]\n"
|
||||
"maxgameticks=60\n"
|
||||
"maxfps=60\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Atomic Bomberman\n"
|
||||
"[BM]\n"
|
||||
"maxgameticks=60\n"
|
||||
|
@ -453,22 +415,6 @@ static void cfg_create_ini()
|
|||
"fake_mode=640x480x32\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
"; Age of Wonders\n"
|
||||
"[AoW]\n"
|
||||
"resolutions=2\n"
|
||||
"nonexclusive=false\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Age of Wonders\n"
|
||||
"[AoWCompat]\n"
|
||||
"resolutions=2\n"
|
||||
"nonexclusive=false\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Age of Wonders Config Tool\n"
|
||||
"[AoWSetup]\n"
|
||||
"resolutions=2\n"
|
||||
"\n"
|
||||
"; Age of Wonders 2\n"
|
||||
"[AoW2]\n"
|
||||
"resolutions=2\n"
|
||||
|
@ -510,30 +456,6 @@ static void cfg_create_ini()
|
|||
"[1602]\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Army Men: World War / Army Men: Operation Meltdown\n"
|
||||
"[amww]\n"
|
||||
"maxfps=60\n"
|
||||
"maxgameticks=120\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Army Men: Air Tactics\n"
|
||||
"[Amat]\n"
|
||||
"maxfps=60\n"
|
||||
"maxgameticks=120\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Army Men: Toys in Space\n"
|
||||
"[ARMYMENTIS]\n"
|
||||
"maxfps=60\n"
|
||||
"maxgameticks=120\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Army Men 2\n"
|
||||
"[ArmyMen2]\n"
|
||||
"maxfps=60\n"
|
||||
"maxgameticks=120\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Alien Nations\n"
|
||||
"[AN]\n"
|
||||
"adjmouse=true\n"
|
||||
|
@ -541,7 +463,7 @@ static void cfg_create_ini()
|
|||
"; Atlantis\n"
|
||||
"[ATLANTIS]\n"
|
||||
"renderer=opengl\n"
|
||||
"maxgameticks=30\n"
|
||||
"maxgameticks=60\n"
|
||||
"center_cursor_fix=true\n"
|
||||
"\n"
|
||||
"; Airline Tycoon Deluxe\n"
|
||||
|
@ -555,13 +477,8 @@ static void cfg_create_ini()
|
|||
"\n"
|
||||
"; Axis & Allies\n"
|
||||
"[AxisAllies]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"maxgameticks=60\n"
|
||||
"\n"
|
||||
"; A Bug's Life Action Game\n"
|
||||
"[bugs]\n"
|
||||
"fix_not_responding=true\n"
|
||||
"\n"
|
||||
"; Barney - Secret of the Rainbow\n"
|
||||
"[Barney]\n"
|
||||
"adjmouse=false\n"
|
||||
|
@ -576,11 +493,6 @@ static void cfg_create_ini()
|
|||
"[BGMain]\n"
|
||||
"resolutions=2\n"
|
||||
"\n"
|
||||
"; Balls of Steel v1.2\n"
|
||||
"[bos]\n"
|
||||
"checkfile=.\\barbarin.ddp\n"
|
||||
"win_version=95\n"
|
||||
"\n"
|
||||
"; BALDR FORCE EXE\n"
|
||||
"[BaldrForce]\n"
|
||||
"noactivateapp=true\n"
|
||||
|
@ -804,14 +716,6 @@ static void cfg_create_ini()
|
|||
"nonexclusive=true\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Cloud Kingdom 3 (only with /ddraw command line parameter)\n"
|
||||
"[Clouds Kingdom 3]\n"
|
||||
"fake_mode=320x240x32\n"
|
||||
"\n"
|
||||
"; Commando 2004 (only with /ddraw command line parameter)\n"
|
||||
"[commando]\n"
|
||||
"fake_mode=320x240x32\n"
|
||||
"\n"
|
||||
"; Chris Sawyer's Locomotion\n"
|
||||
"[LOCO/2]\n"
|
||||
"checkfile=.\\LOCO.EXE\n"
|
||||
|
@ -827,30 +731,21 @@ static void cfg_create_ini()
|
|||
"\n"
|
||||
"; Close Combat 2: A Bridge Too Far\n"
|
||||
"[cc2]\n"
|
||||
"maxgameticks=20\n"
|
||||
"limiter_type=4\n"
|
||||
"minfps=15\n"
|
||||
"adjmouse=true\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
"; Close Combat 3: The Russian Front\n"
|
||||
"[cc3]\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=2\n"
|
||||
"adjmouse=true\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
"; Close Combat 4: The Battle of the Bulge\n"
|
||||
"[cc4]\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=2\n"
|
||||
"adjmouse=true\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
"; Close Combat 5: Invasion: Normandy\n"
|
||||
"[cc5]\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=2\n"
|
||||
"adjmouse=true\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
|
@ -881,33 +776,17 @@ static void cfg_create_ini()
|
|||
"[corsairs]\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Dark Colony\n"
|
||||
"[dc16]\n"
|
||||
"maxgameticks=30\n"
|
||||
"darkcolony_hack=true\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Divine Divinity\n"
|
||||
"[div]\n"
|
||||
"resolutions=2\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Die by the Sword\n"
|
||||
"[windie]\n"
|
||||
"maxgameticks=30\n"
|
||||
"\n"
|
||||
"; Dragon Throne: Battle of Red Cliffs\n"
|
||||
"[AdSanguo]\n"
|
||||
"maxgameticks=60\n"
|
||||
"noactivateapp=true\n"
|
||||
"limiter_type=2\n"
|
||||
"\n"
|
||||
"; Dark Secret of Africa\n"
|
||||
"[Game/5]\n"
|
||||
"checkfile=.\\CONFIG.CFG\n"
|
||||
"maxfps=60\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Dark Reign: The Future of War\n"
|
||||
"[DKReign]\n"
|
||||
"maxgameticks=60\n"
|
||||
|
@ -917,10 +796,6 @@ static void cfg_create_ini()
|
|||
"maxgameticks=60\n"
|
||||
"noactivateapp=true\n"
|
||||
"\n"
|
||||
"; Dreams to Realty\n"
|
||||
"[windream]\n"
|
||||
"maxgameticks=60\n"
|
||||
"\n"
|
||||
"; Deadlock 2\n"
|
||||
"[DEADLOCK]\n"
|
||||
"fixchilds=0\n"
|
||||
|
@ -942,18 +817,9 @@ static void cfg_create_ini()
|
|||
"lock_mouse_top_left=true\n"
|
||||
"renderer=gdi\n"
|
||||
"\n"
|
||||
"; Discoworld Noir\n"
|
||||
"[dn]\n"
|
||||
"fake_mode=640x480x16\n"
|
||||
"\n"
|
||||
"; Dominion - Storm Over Gift 3\n"
|
||||
"[dominion]\n"
|
||||
"flipclear=true\n"
|
||||
"\n"
|
||||
"; Escape Velocity Nova\n"
|
||||
"[EV Nova]\n"
|
||||
"nonexclusive=true\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"rgb555=true\n"
|
||||
"keytogglefullscreen=0x46\n"
|
||||
"adjmouse=true\n"
|
||||
|
@ -961,56 +827,17 @@ static void cfg_create_ini()
|
|||
"; Economic War\n"
|
||||
"[EcoW]\n"
|
||||
"maxgameticks=60\n"
|
||||
"fix_not_responding=true\n"
|
||||
"fixnotresponding=true\n"
|
||||
"\n"
|
||||
"; Emperor: Rise of the Middle Kingdom\n"
|
||||
"[Emperor]\n"
|
||||
"nonexclusive=true\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Enemy Infestation\n"
|
||||
"[EI]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; F-16 Agressor\n"
|
||||
"[f-16]\n"
|
||||
"resolutions=1\n"
|
||||
"\n"
|
||||
"; Fallout Tactics: Brotherhood of Steel\n"
|
||||
"[BOS/2]\n"
|
||||
"checkfile=.\\binkw32.dll\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Fallout Tactics: Brotherhood of Steel\n"
|
||||
"[BOS_HR]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Fallout Tactics: Brotherhood of Steel\n"
|
||||
"[FT Tools]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Flight Simulator 98\n"
|
||||
"[FLTSIM95]\n"
|
||||
"flightsim98_hack=true\n"
|
||||
"\n"
|
||||
"; Flight Simulator 98\n"
|
||||
"[FLTSIM98]\n"
|
||||
"flightsim98_hack=true\n"
|
||||
"\n"
|
||||
"; Fairy Tale About Father Frost, Ivan and Nastya\n"
|
||||
"[mrazik]\n"
|
||||
"guard_lines=0\n"
|
||||
"\n"
|
||||
"; Fable\n"
|
||||
"[Fable]\n"
|
||||
"maxgameticks=59\n"
|
||||
"limiter_type=4\n"
|
||||
"\n"
|
||||
"; Final Liberation: Warhammer Epic 40000\n"
|
||||
"[Epic40k]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"maxgameticks=125\n"
|
||||
"\n"
|
||||
"; Future Cop - L.A.P.D.\n"
|
||||
"[FCopLAPD]\n"
|
||||
"nonexclusive=true\n"
|
||||
|
@ -1055,7 +882,7 @@ static void cfg_create_ini()
|
|||
"\n"
|
||||
"; Glover\n"
|
||||
"[glover]\n"
|
||||
"fix_not_responding=true\n"
|
||||
"fixnotresponding=true\n"
|
||||
"\n"
|
||||
"; G-Police\n"
|
||||
"[GPOLICE]\n"
|
||||
|
@ -1065,8 +892,6 @@ static void cfg_create_ini()
|
|||
"[gangsters]\n"
|
||||
"adjmouse=true\n"
|
||||
"nonexclusive=true\n"
|
||||
"fixchilds=0\n"
|
||||
"fake_mode=640x480x8\n"
|
||||
"\n"
|
||||
"; Grand Theft Auto\n"
|
||||
"[Grand Theft Auto]\n"
|
||||
|
@ -1089,20 +914,20 @@ static void cfg_create_ini()
|
|||
"; Girl Talk\n"
|
||||
"[GirlTalk]\n"
|
||||
"resolutions=2\n"
|
||||
"game_handles_close=true\n"
|
||||
"\n"
|
||||
"; Jazz Jackrabbit 2 plus\n"
|
||||
"[Jazz2]\n"
|
||||
"keytogglefullscreen=0x08\n"
|
||||
"inject_resolution=800x450\n"
|
||||
"\n"
|
||||
"; Jazz Jackrabbit 2\n"
|
||||
"[Jazz2_NonPlus]\n"
|
||||
"keytogglefullscreen=0x08\n"
|
||||
"inject_resolution=800x450\n"
|
||||
"\n"
|
||||
"; Jungle Storm\n"
|
||||
"[Jstorm]\n"
|
||||
"no_compat_warning=true\n"
|
||||
"win_version=98\n"
|
||||
"\n"
|
||||
"; Hades Challenge\n"
|
||||
"[HADESCH]\n"
|
||||
|
@ -1111,30 +936,28 @@ static void cfg_create_ini()
|
|||
"; Heroes of Might and Magic II: The Succession Wars\n"
|
||||
"[HEROES2W]\n"
|
||||
"adjmouse=true\n"
|
||||
"game_handles_close=true\n"
|
||||
"keytogglefullscreen2=0x73\n"
|
||||
"\n"
|
||||
"; Heroes of Might and Magic III\n"
|
||||
"[Heroes3]\n"
|
||||
"renderer=opengl\n"
|
||||
"game_handles_close=true\n"
|
||||
"keytogglefullscreen2=0x73\n"
|
||||
"homm_hack=true\n"
|
||||
"\n"
|
||||
"; Heroes of Might and Magic III HD Mod\n"
|
||||
"[Heroes3 HD]\n"
|
||||
"renderer=opengl\n"
|
||||
"game_handles_close=true\n"
|
||||
"keytogglefullscreen2=0x73\n"
|
||||
"homm_hack=true\n"
|
||||
"\n"
|
||||
"; Heroes of Might and Magic III - Master of Puppets mod\n"
|
||||
"[MoP]\n"
|
||||
"game_handles_close=true\n"
|
||||
"keytogglefullscreen2=0x73\n"
|
||||
"homm_hack=true\n"
|
||||
"\n"
|
||||
"; Heroes of Might and Magic IV\n"
|
||||
"[heroes4]\n"
|
||||
"remove_menu=true\n"
|
||||
"keytogglefullscreen2=0x73\n"
|
||||
"homm_hack=true\n"
|
||||
"\n"
|
||||
"; Hard Truck: Road to Victory\n"
|
||||
"[htruck]\n"
|
||||
|
@ -1142,19 +965,6 @@ static void cfg_create_ini()
|
|||
"renderer=opengl\n"
|
||||
"noactivateapp=true\n"
|
||||
"\n"
|
||||
"; Hooligans: Storm over Europe\n"
|
||||
"[hooligans]\n"
|
||||
"limit_gdi_handles=true\n"
|
||||
"\n"
|
||||
"; Imperialism 2: The Age of Exploration\n"
|
||||
"[Imperialism II]\n"
|
||||
"adjmouse=false\n"
|
||||
"width=0\n"
|
||||
"height=0\n"
|
||||
"resizable=false\n"
|
||||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"\n"
|
||||
"; Icewind Dale 2\n"
|
||||
"; Note: 'Full Screen' must be enabled in Config.exe\n"
|
||||
"; Note: 1070x602 is the lowest possible 16:9 resolution for the Widescreen patch (600/601 height will crash)\n"
|
||||
|
@ -1186,48 +996,44 @@ static void cfg_create_ini()
|
|||
"; Jagged Alliance 2\n"
|
||||
"[ja2]\n"
|
||||
"singlecpu=false\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"fixmousehook=true\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; Jagged Alliance 2: Unfinished Business\n"
|
||||
"[JA2UB]\n"
|
||||
"singlecpu=false\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"fixmousehook=true\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; Jagged Alliance 2: Wildfire\n"
|
||||
"[WF6]\n"
|
||||
"singlecpu=false\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"fixmousehook=true\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; Jagged Alliance 2 - UC mod\n"
|
||||
"[JA2_UC]\n"
|
||||
"singlecpu=false\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"fixmousehook=true\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; Jagged Alliance 2 - Vengeance Reloaded mod\n"
|
||||
"[JA2_Vengeance]\n"
|
||||
"singlecpu=false\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"fixmousehook=true\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; Jagged Alliance 2 - Vengeance Reloaded mod German exe\n"
|
||||
"[JA2_Vengeance_DE]\n"
|
||||
"singlecpu=false\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"; Jedi Knight Dark Forces 2\n"
|
||||
"[JK]\n"
|
||||
"direct3d_passthrough=true\n"
|
||||
"\n"
|
||||
"; Jeopardy! - NOT WORKING YET\n"
|
||||
"[jeoppc]\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Karma Immortal Wrath\n"
|
||||
"[karma]\n"
|
||||
"fix_not_responding=true\n"
|
||||
"maxgameticks=60\n"
|
||||
"limiter_type=4\n"
|
||||
"; Kings Quest 8\n"
|
||||
"[Mask]\n"
|
||||
"renderer=opengl\n"
|
||||
"\n"
|
||||
"; Konung\n"
|
||||
"[konung]\n"
|
||||
|
@ -1255,15 +1061,6 @@ static void cfg_create_ini()
|
|||
"limiter_type=2\n"
|
||||
"maxgameticks=60\n"
|
||||
"\n"
|
||||
"; Lode Runner 2\n"
|
||||
"[LR2]\n"
|
||||
"no_dinput_hook=true\n"
|
||||
"fake_mode=640x480x16\n"
|
||||
"\n"
|
||||
"; Last Bronx\n"
|
||||
"[LB]\n"
|
||||
"maxgameticks=30\n"
|
||||
"\n"
|
||||
"; Lapis (lapis.mgame.com)\n"
|
||||
"[Lapis]\n"
|
||||
"fixchilds=3\n"
|
||||
|
@ -1305,22 +1102,6 @@ static void cfg_create_ini()
|
|||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"\n"
|
||||
"; Lionheart\n"
|
||||
"[Lionheart]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Lost Vikings 2\n"
|
||||
"[LOSTV95]\n"
|
||||
"fake_mode=320x240x16\n"
|
||||
"\n"
|
||||
"; Nightmare Creatures\n"
|
||||
"[NC]\n"
|
||||
"maxgameticks=30\n"
|
||||
"\n"
|
||||
"; Moto Racer (software mode)\n"
|
||||
"[moto]\n"
|
||||
"maxgameticks=59\n"
|
||||
"\n"
|
||||
"; Madeline 1st Grade Math\n"
|
||||
"[madmath1]\n"
|
||||
"nonexclusive=true\n"
|
||||
|
@ -1331,9 +1112,6 @@ static void cfg_create_ini()
|
|||
"resizable=false\n"
|
||||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"renderer=gdi\n"
|
||||
"hook=2\n"
|
||||
"win_version=nt4\n"
|
||||
"\n"
|
||||
"; Madeline 1st Grade Math: Progress Report\n"
|
||||
"[madpr]\n"
|
||||
|
@ -1345,9 +1123,6 @@ static void cfg_create_ini()
|
|||
"resizable=false\n"
|
||||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"renderer=gdi\n"
|
||||
"hook=2\n"
|
||||
"win_version=nt4\n"
|
||||
"\n"
|
||||
"; Madeline 2nd Grade Math\n"
|
||||
"[madmath2]\n"
|
||||
|
@ -1359,9 +1134,6 @@ static void cfg_create_ini()
|
|||
"resizable=false\n"
|
||||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"renderer=gdi\n"
|
||||
"hook=2\n"
|
||||
"win_version=nt4\n"
|
||||
"\n"
|
||||
"; Majesty Gold\n"
|
||||
"[Majesty]\n"
|
||||
|
@ -1375,39 +1147,17 @@ static void cfg_create_ini()
|
|||
"[MajestyHD - Old]\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Meat Puppet\n"
|
||||
"[meat]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Mech Warrior 3\n"
|
||||
"[Mech3]\n"
|
||||
"nonexclusive=true\n"
|
||||
"\n"
|
||||
"; Men In Black - NOT WORKING YET\n"
|
||||
"[MIB]\n"
|
||||
"hook=2\n"
|
||||
"\n"
|
||||
"; Moorhuhn 2\n"
|
||||
"[Moorhuhn2]\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"\n"
|
||||
"; Metal Knight\n"
|
||||
"[mk]\n"
|
||||
"maxgameticks=60\n"
|
||||
"limiter_type=4\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; New Robinson\n"
|
||||
"[ROBY]\n"
|
||||
"adjmouse=true\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Neo Sonic Universe\n"
|
||||
"[nsu]\n"
|
||||
"fake_mode=320x240x32\n"
|
||||
"\n"
|
||||
"; Neo Sonic Universe - battle mode\n"
|
||||
"[nsu_battle]\n"
|
||||
"fake_mode=320x240x32\n"
|
||||
"\n"
|
||||
"; Nancy Drew (All games)\n"
|
||||
"[Game/3]\n"
|
||||
|
@ -1415,10 +1165,6 @@ static void cfg_create_ini()
|
|||
"limiter_type=1\n"
|
||||
"maxgameticks=120\n"
|
||||
"\n"
|
||||
"; NBA Full Court Press\n"
|
||||
"[NBA_FCP]\n"
|
||||
"fake_mode=640x480x8\n"
|
||||
"\n"
|
||||
"; Nox\n"
|
||||
"[NOX]\n"
|
||||
"checkfile=.\\NOX.ICD\n"
|
||||
|
@ -1443,10 +1189,6 @@ static void cfg_create_ini()
|
|||
"adjmouse=true\n"
|
||||
"renderer=gdi\n"
|
||||
"\n"
|
||||
"; Pandora's Box Puzzle Game\n"
|
||||
"[Pandora]\n"
|
||||
"fixchilds=0\n"
|
||||
"\n"
|
||||
"; Paddle Bash Hotshot\n"
|
||||
"[SPAGHSPaddle]\n"
|
||||
"no_compat_warning=true\n"
|
||||
|
@ -1467,6 +1209,10 @@ static void cfg_create_ini()
|
|||
"[Pajama3]\n"
|
||||
"renderer=gdi\n"
|
||||
"\n"
|
||||
"; Pajama Sam(r): Life is Rough When You Lose Your Stuff(tm)\n"
|
||||
"[PajamaLRS]\n"
|
||||
"keytogglefullscreen=0x08\n"
|
||||
"\n"
|
||||
"; Pajama Sam's One-Stop Fun Shop\n"
|
||||
"[SamsFunShop]\n"
|
||||
"renderer=gdi\n"
|
||||
|
@ -1520,6 +1266,10 @@ static void cfg_create_ini()
|
|||
"[puttputtjtc]\n"
|
||||
"renderer=gdi\n"
|
||||
"\n"
|
||||
"; Putt-Putt: Pep's Birthday Surprise\n"
|
||||
"[PuttsFunShop]\n"
|
||||
"keytogglefullscreen=0x08\n"
|
||||
"\n"
|
||||
"; Pizza Syndicate\n"
|
||||
"[Pizza2]\n"
|
||||
"renderer=opengl\n"
|
||||
|
@ -1536,19 +1286,8 @@ static void cfg_create_ini()
|
|||
"[PlayWTT]\n"
|
||||
"hook=3\n"
|
||||
"\n"
|
||||
"; Populous - The Beginning\n"
|
||||
"[popTB]\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Rage of Mages\n"
|
||||
"[rom]\n"
|
||||
"maxgameticks=60\n"
|
||||
"limiter_type=4\n"
|
||||
"singlecpu=true\n"
|
||||
"\n"
|
||||
"; Railroad Tycoon II\n"
|
||||
"[RT2]\n"
|
||||
"maxgameticks=60"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Reader Rabbit Thinking Ages 4-6 (US)\n"
|
||||
|
@ -1585,15 +1324,6 @@ static void cfg_create_ini()
|
|||
"maxgameticks=60\n"
|
||||
"limiter_type=3\n"
|
||||
"\n"
|
||||
"; Return to Krondor\n"
|
||||
"[RtK]\n"
|
||||
"fixchilds=3\n"
|
||||
"lock_mouse_top_left=true\n"
|
||||
"limiter_type=2\n"
|
||||
"game_handles_close=true\n"
|
||||
"maxgameticks=59\n"
|
||||
"anti_aliased_fonts_min_size=99\n"
|
||||
"\n"
|
||||
"; ROAD RASH\n"
|
||||
"[RoadRash]\n"
|
||||
"adjmouse=true\n"
|
||||
|
@ -1603,22 +1333,14 @@ static void cfg_create_ini()
|
|||
"[Game/4]\n"
|
||||
"checkfile=.\\Robin Hood.exe\n"
|
||||
"singlecpu=false\n"
|
||||
"fix_not_responding=true\n"
|
||||
"\n"
|
||||
"; Robin Hood - The Legend of Sherwood (Steam)\n"
|
||||
"[_rh]\n"
|
||||
"singlecpu=false\n"
|
||||
"fix_not_responding=true\n"
|
||||
"\n"
|
||||
"; Robin Hood - The Legend of Sherwood\n"
|
||||
"[Robin Hood]\n"
|
||||
"singlecpu=false\n"
|
||||
"fix_not_responding=true\n"
|
||||
"\n"
|
||||
"; Rising Lands\n"
|
||||
"[Rising]\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=4\n"
|
||||
"\n"
|
||||
"; Scooby-Doo(TM), Case File #1 The Glowing Bug Man - NOT WORKING YET\n"
|
||||
"[Case File #1]\n"
|
||||
|
@ -1626,21 +1348,6 @@ static void cfg_create_ini()
|
|||
"nonexclusive=true\n"
|
||||
"fake_mode=640x480x32\n"
|
||||
"\n"
|
||||
"; Seven Kingdoms II\n"
|
||||
"[7k2]\n"
|
||||
"fake_mode=352x240x32\n"
|
||||
"fix_not_responding=true\n"
|
||||
"\n"
|
||||
"; Seven Games of the Soul\n"
|
||||
"[faust]\n"
|
||||
"maxgameticks=25\n"
|
||||
"\n"
|
||||
"; Swarog\n"
|
||||
"[Swarog]\n"
|
||||
"maxfps=60\n"
|
||||
"maxgameticks=60\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Sim Copter\n"
|
||||
"[SimCopter]\n"
|
||||
"nonexclusive=true\n"
|
||||
|
@ -1657,15 +1364,6 @@ static void cfg_create_ini()
|
|||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"\n"
|
||||
"; Star Wars Rebellion\n"
|
||||
"[REBEXE]\n"
|
||||
"adjmouse=false\n"
|
||||
"width=0\n"
|
||||
"height=0\n"
|
||||
"resizable=false\n"
|
||||
"maintas=false\n"
|
||||
"boxing=false\n"
|
||||
"\n"
|
||||
"; Star Wars: Galactic Battlegrounds\n"
|
||||
"[battlegrounds]\n"
|
||||
"nonexclusive=true\n"
|
||||
|
@ -1680,10 +1378,6 @@ static void cfg_create_ini()
|
|||
"[StarCraft]\n"
|
||||
"game_handles_close=true\n"
|
||||
"\n"
|
||||
"; Space Rangers\n"
|
||||
"[Rangers]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; SPYFox: Hold the Mustard\n"
|
||||
"[mustard]\n"
|
||||
"renderer=gdi\n"
|
||||
|
@ -1733,45 +1427,16 @@ static void cfg_create_ini()
|
|||
"; Sim City 3000\n"
|
||||
"[SC3]\n"
|
||||
"minfps=-2\n"
|
||||
"maxgameticks=60\n"
|
||||
"\n"
|
||||
"; SimTunes\n"
|
||||
"[SIMTUNES]\n"
|
||||
"terminate_process=true\n"
|
||||
"hook=3\n"
|
||||
"\n"
|
||||
"; Street Wars: Constructor Underworld\n"
|
||||
"[Sw]\n"
|
||||
"checkfile=.\\smackw32.dll\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=4\n"
|
||||
"\n"
|
||||
"; Shadow Watch\n"
|
||||
"[sw/2]\n"
|
||||
"checkfile=.\\Dx.dll\n"
|
||||
"[sw]\n"
|
||||
"adjmouse=true\n"
|
||||
"maxgameticks=30\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Shadow Flare\n"
|
||||
"[ShadowFlare]\n"
|
||||
"nonexclusive=true\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Squad Leader\n"
|
||||
"[SquadLeader]\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=4\n"
|
||||
"\n"
|
||||
"; Soldiers At War\n"
|
||||
"[SAW_Game]\n"
|
||||
"maxgameticks=30\n"
|
||||
"limiter_type=4\n"
|
||||
"\n"
|
||||
"; The Tone Rebellion\n"
|
||||
"[Float]\n"
|
||||
"hook_peekmessage=true\n"
|
||||
"\n"
|
||||
"; Total Annihilation (Unofficial Beta Patch v3.9.02)\n"
|
||||
"[TotalA]\n"
|
||||
"max_resolutions=32\n"
|
||||
|
@ -1784,10 +1449,6 @@ static void cfg_create_ini()
|
|||
"lock_surfaces=true\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Virtual Springfield\n"
|
||||
"[VIRTUAL]\n"
|
||||
"game_handles_close=true\n"
|
||||
"\n"
|
||||
"; Total Annihilation: Kingdoms\n"
|
||||
"[Kingdoms]\n"
|
||||
"game_handles_close=true\n"
|
||||
|
@ -1816,7 +1477,7 @@ static void cfg_create_ini()
|
|||
"\n"
|
||||
"; The Jungle Book Groove Party\n"
|
||||
"[Jungle_vr]\n"
|
||||
"fix_not_responding=true\n"
|
||||
"fixnotresponding=true\n"
|
||||
"\n"
|
||||
"; Three Kingdoms: Fate of the Dragon\n"
|
||||
"[sanguo]\n"
|
||||
|
@ -1856,13 +1517,6 @@ static void cfg_create_ini()
|
|||
"[Tzar]\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Unreal\n"
|
||||
"[Unreal]\n"
|
||||
"adjmouse=false\n"
|
||||
"lock_mouse_top_left=true\n"
|
||||
"center_cursor_fix=true\n"
|
||||
"noactivateapp=true\n"
|
||||
"\n"
|
||||
"; Uprising\n"
|
||||
"[uprising]\n"
|
||||
"adjmouse=true\n"
|
||||
|
@ -1877,36 +1531,16 @@ static void cfg_create_ini()
|
|||
"adjmouse=true\n"
|
||||
"fake_mode=640x480x32\n"
|
||||
"\n"
|
||||
"; Virtua Fighter 2\n"
|
||||
"[VF2]\n"
|
||||
"fake_mode=640x480x8\n"
|
||||
"\n"
|
||||
"; Virtual On: Cyber Troopers\n"
|
||||
"[V_ON]\n"
|
||||
"devmode=true\n"
|
||||
"windowed=true\n"
|
||||
"fullscreen=true\n"
|
||||
"toggle_borderless=true\n"
|
||||
"\n"
|
||||
"; Wall Street Trader 2000 - NOT WORKING YET\n"
|
||||
"[WSTrader]\n"
|
||||
"nonexclusive=false\n"
|
||||
"windowed=false\n"
|
||||
"\n"
|
||||
"; WarCraft 2000: Nuclear Epidemic\n"
|
||||
"[war2000]\n"
|
||||
"resolutions=2\n"
|
||||
"guard_lines=600\n"
|
||||
"minfps=-2\n"
|
||||
"\n"
|
||||
"; Warhammer 40000: Chaos Gate\n"
|
||||
"[WH40K]\n"
|
||||
"maxgameticks=250\n"
|
||||
"\n"
|
||||
"; Wizardry 8\n"
|
||||
"[Wiz8]\n"
|
||||
"sirtech_hack=true\n"
|
||||
"fix_alt_key_stuck=true\n"
|
||||
"fixmousehook=true\n"
|
||||
"releasealt=true\n"
|
||||
"\n"
|
||||
"; Worms 2\n"
|
||||
"[worms2]\n"
|
||||
|
@ -1917,30 +1551,19 @@ static void cfg_create_ini()
|
|||
"\n"
|
||||
"; Worms Armageddon\n"
|
||||
"[WA]\n"
|
||||
"lock_mouse_top_left=true\n"
|
||||
"\n"
|
||||
"; Wheel Of Fortune\n"
|
||||
"[WHEEL]\n"
|
||||
"singlecpu=false\n"
|
||||
"adjmouse=true\n"
|
||||
"width=0\n"
|
||||
"height=0\n"
|
||||
"resizable=false\n"
|
||||
"\n"
|
||||
"; War Wind\n"
|
||||
"[WW]\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Jeff Wayne's 'The War Of The Worlds'\n"
|
||||
"[WoW]\n"
|
||||
"minfps=-1\n"
|
||||
"\n"
|
||||
"; Zeus and Poseidon\n"
|
||||
"[Zeus]\n"
|
||||
"adjmouse=true\n"
|
||||
"\n"
|
||||
"; Zork Nemesis\n"
|
||||
"[znemesis]\n"
|
||||
"fix_not_responding=true\n"
|
||||
"maxgameticks=60\n"
|
||||
"limiter_type=4\n"
|
||||
"\n"
|
||||
|
||||
, fh);
|
||||
fclose(fh);
|
||||
|
|
23
src/crc32.c
23
src/crc32.c
|
@ -77,29 +77,6 @@ unsigned long Crc32_ComputeBuf( unsigned long inCrc32, const void *buf,
|
|||
return( crc32 ^ 0xFFFFFFFF );
|
||||
}
|
||||
|
||||
unsigned long Crc32_FromFile(unsigned long crc32, char* filename)
|
||||
{
|
||||
if (!filename)
|
||||
return 0;
|
||||
|
||||
FILE* fp = fopen(filename, "rb");
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
char buf[1024];
|
||||
for (size_t s = 0; (s = fread(buf, 1, sizeof(buf), fp)) && !ferror(fp);)
|
||||
{
|
||||
crc32 = Crc32_ComputeBuf(crc32, buf, s);
|
||||
}
|
||||
|
||||
if (ferror(fp))
|
||||
crc32 = 0;
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return crc32;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
* END OF MODULE: crc32.c
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
|
115
src/dd.c
115
src/dd.c
|
@ -518,7 +518,6 @@ HRESULT dd_GetCaps(LPDDCAPS_DX1 lpDDDriverCaps, LPDDCAPS_DX1 lpDDEmulCaps)
|
|||
memset(lpDDEmulCaps, 0, size);
|
||||
|
||||
lpDDEmulCaps->dwSize = size;
|
||||
lpDDEmulCaps->dwCaps = DDCAPS_BLTSTRETCH;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
|
@ -560,7 +559,7 @@ HRESULT dd_GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
|
|||
lpDDSurfaceDesc->dwWidth = width;
|
||||
lpDDSurfaceDesc->dwHeight = height;
|
||||
|
||||
if (bpp == 32 || bpp == 24)
|
||||
if (bpp == 32)
|
||||
{
|
||||
lpDDSurfaceDesc->ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||
lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0xFF0000;
|
||||
|
@ -613,8 +612,6 @@ HRESULT dd_GetVerticalBlankStatus(LPBOOL lpbIsInVB)
|
|||
*lpbIsInVB = TRUE;
|
||||
}
|
||||
|
||||
TRACE(" lpbIsInVB = %s\n", *lpbIsInVB ? "TRUE" : "FALSE");
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -711,14 +708,9 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
g_ddraw.render.height = g_config.window_rect.bottom;
|
||||
|
||||
/* temporary fix: center window for games that keep changing their resolution */
|
||||
if (g_config.center_window &&
|
||||
(g_ddraw.width || g_config.infantryhack || g_config.center_window == CENTER_WINDOW_ALWAYS) &&
|
||||
if ((g_ddraw.width || g_config.infantryhack) &&
|
||||
(g_ddraw.width != dwWidth || g_ddraw.height != dwHeight) &&
|
||||
(
|
||||
dwWidth > g_config.window_rect.right ||
|
||||
dwHeight > g_config.window_rect.bottom ||
|
||||
g_config.center_window == CENTER_WINDOW_ALWAYS)
|
||||
)
|
||||
(dwWidth > g_config.window_rect.right || dwHeight > g_config.window_rect.bottom))
|
||||
{
|
||||
g_config.window_rect.left = -32000;
|
||||
g_config.window_rect.top = -32000;
|
||||
|
@ -890,7 +882,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
|
||||
g_config.windowed = TRUE;
|
||||
g_config.fullscreen = TRUE;
|
||||
g_config.toggle_borderless = TRUE;
|
||||
border = FALSE;
|
||||
|
||||
/* prevent OpenGL from going automatically into fullscreen exclusive mode */
|
||||
|
@ -928,12 +919,15 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
|
||||
if (g_config.boxing)
|
||||
{
|
||||
g_ddraw.render.viewport.width = g_ddraw.width;
|
||||
g_ddraw.render.viewport.height = g_ddraw.height;
|
||||
|
||||
for (int i = 20; i-- > 1;)
|
||||
{
|
||||
if (g_ddraw.width * i <= g_ddraw.render.width && g_ddraw.height * i <= g_ddraw.render.height)
|
||||
{
|
||||
g_ddraw.render.viewport.width = i * g_ddraw.width;
|
||||
g_ddraw.render.viewport.height = i * g_ddraw.height;
|
||||
g_ddraw.render.viewport.width *= i;
|
||||
g_ddraw.render.viewport.height *= i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1035,8 +1029,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
if (g_config.remove_menu && GetMenu(g_ddraw.hwnd))
|
||||
SetMenu(g_ddraw.hwnd, NULL);
|
||||
|
||||
if (!g_config.fix_not_responding &&
|
||||
g_ddraw.last_msg_pull_tick &&
|
||||
if (g_ddraw.last_msg_pull_tick &&
|
||||
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
|
||||
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
|
||||
!IsWine())
|
||||
|
@ -1062,12 +1055,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
g_ddraw.hwnd,
|
||||
GWL_STYLE,
|
||||
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW) & ~(WS_MAXIMIZE));
|
||||
|
||||
DWORD class_sytle = GetClassLongA(g_ddraw.hwnd, GCL_STYLE);
|
||||
if (class_sytle & CS_NOCLOSE)
|
||||
{
|
||||
SetClassLongA(g_ddraw.hwnd, GCL_STYLE, class_sytle & ~CS_NOCLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
LONG exstyle = real_GetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE);
|
||||
|
@ -1084,14 +1071,12 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
real_SetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE, exstyle & ~(WS_EX_CLIENTEDGE));
|
||||
}
|
||||
|
||||
if (IsWine())
|
||||
if (!g_config.wine_allow_resize && IsWine())
|
||||
{
|
||||
LONG remove_flags = !g_config.resizable ? (WS_MAXIMIZEBOX | WS_THICKFRAME) : 0;
|
||||
|
||||
real_SetWindowLongA(
|
||||
g_ddraw.hwnd,
|
||||
GWL_STYLE,
|
||||
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_MINIMIZEBOX) & ~(remove_flags));
|
||||
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_MINIMIZEBOX) & ~(WS_MAXIMIZEBOX | WS_THICKFRAME));
|
||||
}
|
||||
|
||||
/* center the window with correct dimensions */
|
||||
|
@ -1254,7 +1239,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
g_ddraw.render.run = FALSE;
|
||||
g_config.windowed = TRUE;
|
||||
g_config.fullscreen = TRUE;
|
||||
g_config.toggle_borderless = TRUE;
|
||||
return dd_SetDisplayMode(dwWidth, dwHeight, dwBPP, dwFlags);
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1255,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
g_ddraw.render.run = FALSE;
|
||||
g_config.windowed = TRUE;
|
||||
g_config.fullscreen = TRUE;
|
||||
g_config.toggle_borderless = TRUE;
|
||||
return dd_SetDisplayMode(dwWidth, dwHeight, dwBPP, dwFlags);
|
||||
}
|
||||
}
|
||||
|
@ -1341,8 +1324,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
InterlockedExchange(&g_ddraw.render.surface_updated, TRUE);
|
||||
ReleaseSemaphore(g_ddraw.render.sem, 1, NULL);
|
||||
|
||||
DWORD tid;
|
||||
g_ddraw.render.thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)g_ddraw.renderer, NULL, 0, &tid);
|
||||
g_ddraw.render.thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)g_ddraw.renderer, NULL, 0, NULL);
|
||||
SetThreadPriority(g_ddraw.render.thread, THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -1352,21 +1334,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||
real_SendMessageA(g_ddraw.hwnd, WM_DISPLAYCHANGE_DDRAW, g_ddraw.bpp, MAKELPARAM(g_ddraw.width, g_ddraw.height));
|
||||
}
|
||||
|
||||
TRACE(
|
||||
" render res=%ux%u (viewport res=%ux%u, x=%d, y=%d)\n",
|
||||
g_ddraw.render.width,
|
||||
g_ddraw.render.height,
|
||||
g_ddraw.render.viewport.width,
|
||||
g_ddraw.render.viewport.height,
|
||||
g_ddraw.render.viewport.x,
|
||||
g_ddraw.render.viewport.y);
|
||||
|
||||
TRACE(
|
||||
" windowed=%s, fullscreen=%s, adjmouse=%s\n",
|
||||
g_config.windowed ? "true" : "false",
|
||||
g_config.fullscreen ? "true" : "false",
|
||||
g_config.adjmouse ? "true" : "false");
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -1403,6 +1370,7 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
|
|||
g_ddraw.gui_thread_id = GetWindowThreadProcessId(g_ddraw.hwnd, NULL);
|
||||
|
||||
keyboard_hook_init();
|
||||
mouse_hook_init();
|
||||
|
||||
if (!g_ddraw.render.hdc)
|
||||
{
|
||||
|
@ -1544,18 +1512,12 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
|
|||
}
|
||||
else if (!g_ddraw.width)
|
||||
{
|
||||
g_ddraw.windowed_hack = TRUE;
|
||||
|
||||
RECT rc = { 0 };
|
||||
real_GetClientRect(hwnd, &rc);
|
||||
|
||||
BOOL popup = real_GetWindowLongA(hwnd, GWL_STYLE) & WS_POPUP;
|
||||
|
||||
if ((rc.right < real_GetSystemMetrics(SM_CXSCREEN) && rc.bottom < real_GetSystemMetrics(SM_CYSCREEN)) || !popup)
|
||||
{
|
||||
TRACE(" client rect=%dx%d\n", rc.right, rc.bottom);
|
||||
|
||||
g_ddraw.windowed_hack = TRUE;
|
||||
dd_SetDisplayMode(rc.right, rc.bottom, 16, 0);
|
||||
}
|
||||
dd_SetDisplayMode(rc.right, rc.bottom, 16, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1570,8 +1532,17 @@ HRESULT dd_WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
|
|||
{
|
||||
if (g_config.maxgameticks == -2)
|
||||
{
|
||||
if (fpsl_wait_for_vblank())
|
||||
return DD_OK;
|
||||
/* Workaround for DwmFlush() freeze (e.g. slow alt+tab) issue on windows 7 SP1 */
|
||||
if (g_ddraw.renderer == ogl_render_main && !IsWine() && !IsWindows8OrGreater())
|
||||
{
|
||||
if (fpsl_wait_for_vblank())
|
||||
return DD_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fpsl_dwm_flush() || fpsl_wait_for_vblank())
|
||||
return DD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_ddraw.flip_limiter.tick_length)
|
||||
|
@ -1706,6 +1677,26 @@ ULONG dd_Release()
|
|||
|
||||
if (g_ddraw.hwnd && IsWindow(g_ddraw.hwnd))
|
||||
{
|
||||
/* restore old window size, required for games that can switch between windowed and fullscreen during runtime */
|
||||
if (g_ddraw.width)
|
||||
{
|
||||
RECT rc = { 0, 0, g_ddraw.width, g_ddraw.height };
|
||||
|
||||
LONG style = real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE);
|
||||
LONG exstyle = real_GetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE);
|
||||
|
||||
AdjustWindowRectEx(&rc, style, GetMenu(g_ddraw.hwnd) != NULL, exstyle);
|
||||
|
||||
real_SetWindowPos(
|
||||
g_ddraw.hwnd,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(rc.right - rc.left),
|
||||
(rc.bottom - rc.top),
|
||||
SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
}
|
||||
|
||||
/* restore old wndproc, subsequent ddraw creation will otherwise fail */
|
||||
real_SetWindowLongA(g_ddraw.hwnd, GWL_WNDPROC, (LONG)g_ddraw.wndproc);
|
||||
}
|
||||
|
@ -1828,17 +1819,7 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
|
|||
|
||||
if (g_config.singlecpu)
|
||||
{
|
||||
if (!IsWine() && IsWindows11Version24H2OrGreater())
|
||||
{
|
||||
if (GetProcessAffinityMask(proc, &proc_affinity, &system_affinity))
|
||||
SetProcessAffinityMask(proc, system_affinity);
|
||||
|
||||
util_set_process_affinity();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProcessAffinityMask(proc, 1);
|
||||
}
|
||||
SetProcessAffinityMask(proc, 1);
|
||||
}
|
||||
else if (GetProcessAffinityMask(proc, &proc_affinity, &system_affinity))
|
||||
{
|
||||
|
|
|
@ -14,15 +14,11 @@ HRESULT ddp_GetEntries(
|
|||
DWORD dwNumEntries,
|
||||
LPPALETTEENTRY lpEntries)
|
||||
{
|
||||
if (!lpEntries)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
for (int i = dwBase, x = 0; i < dwBase + dwNumEntries && i < 256; i++, x++)
|
||||
for (int i = dwBase, x = 0; i < dwBase + dwNumEntries; i++, x++)
|
||||
{
|
||||
lpEntries[x].peRed = This->data_rgb[i].rgbRed;
|
||||
lpEntries[x].peGreen = This->data_rgb[i].rgbGreen;
|
||||
lpEntries[x].peBlue = This->data_rgb[i].rgbBlue;
|
||||
lpEntries[x].peFlags = 0;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
|
@ -35,17 +31,7 @@ HRESULT ddp_SetEntries(
|
|||
DWORD dwCount,
|
||||
LPPALETTEENTRY lpEntries)
|
||||
{
|
||||
if (!lpEntries)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
RGBQUAD data_rgb[256];
|
||||
|
||||
if ((dwFlags & DDPCAPS_REFRESH_CHANGED_ONLY))
|
||||
{
|
||||
memcpy(data_rgb, This->data_rgb, sizeof(This->data_rgb));
|
||||
}
|
||||
|
||||
for (int i = dwStartingEntry, x = 0; i < dwStartingEntry + dwCount && i < 256; i++, x++)
|
||||
for (int i = dwStartingEntry, x = 0; i < dwStartingEntry + dwCount; i++, x++)
|
||||
{
|
||||
This->data_bgr[i] = (lpEntries[x].peBlue << 16) | (lpEntries[x].peGreen << 8) | lpEntries[x].peRed;
|
||||
|
||||
|
@ -71,17 +57,6 @@ HRESULT ddp_SetEntries(
|
|||
This->data_rgb[255].rgbReserved = 0;
|
||||
}
|
||||
|
||||
if ((dwFlags & DDPCAPS_REFRESH_CHANGED_ONLY))
|
||||
{
|
||||
if (memcmp(data_rgb, This->data_rgb, sizeof(This->data_rgb)) == 0)
|
||||
{
|
||||
// do not set palette_updated BOOL if nothing changed
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
TRACE_EXT(" Palette changed\n");
|
||||
}
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.primary && g_ddraw.primary->palette == This && g_ddraw.render.run)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.palette_updated, TRUE);
|
||||
|
|
158
src/ddsurface.c
158
src/ddsurface.c
|
@ -12,10 +12,7 @@
|
|||
#include "blt.h"
|
||||
#include "config.h"
|
||||
#include "ddclipper.h"
|
||||
#include "utils.h"
|
||||
#include "versionhelpers.h"
|
||||
#include "ddpalette.h"
|
||||
#include "palette.h"
|
||||
|
||||
|
||||
LONG g_dds_gdi_handles;
|
||||
|
@ -50,19 +47,20 @@ HRESULT dds_Blt(
|
|||
DWORD dwFlags,
|
||||
LPDDBLTFX lpDDBltFx)
|
||||
{
|
||||
if (lpDDSrcSurface &&
|
||||
lpDDSrcSurface->bpp != 8 &&
|
||||
lpDDSrcSurface->bpp != 16 &&
|
||||
lpDDSrcSurface->bpp != 24 &&
|
||||
lpDDSrcSurface->bpp != 32)
|
||||
{
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
dbg_dump_dds_blt_flags(dwFlags);
|
||||
dbg_dump_dds_blt_fx_flags((dwFlags & DDBLT_DDFX) && lpDDBltFx ? lpDDBltFx->dwDDFX : 0);
|
||||
|
||||
util_pull_messages();
|
||||
if (g_config.fixnotresponding &&
|
||||
g_ddraw.hwnd &&
|
||||
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
|
||||
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
|
||||
!IsWine())
|
||||
{
|
||||
/* workaround for "Not Responding" window problem */
|
||||
g_ddraw.last_msg_pull_tick = timeGetTime();
|
||||
MSG msg;
|
||||
real_PeekMessageA(&msg, g_ddraw.hwnd, 0, 0, PM_NOREMOVE | PM_QS_INPUT);
|
||||
}
|
||||
|
||||
if (g_ddraw.ref &&
|
||||
g_ddraw.iskkndx &&
|
||||
|
@ -85,16 +83,10 @@ HRESULT dds_Blt(
|
|||
RECT dst_rect = { 0, 0, This->width, This->height };
|
||||
|
||||
if (lpSrcRect && src_surface)
|
||||
{
|
||||
//dbg_print_rect("lpSrcRect", lpSrcRect);
|
||||
src_rect = *lpSrcRect;
|
||||
}
|
||||
memcpy(&src_rect, lpSrcRect, sizeof(src_rect));
|
||||
|
||||
if (lpDestRect)
|
||||
{
|
||||
//dbg_print_rect("lpDestRect", lpDestRect);
|
||||
dst_rect = *lpDestRect;
|
||||
}
|
||||
memcpy(&dst_rect, lpDestRect, sizeof(dst_rect));
|
||||
|
||||
int src_w = src_rect.right - src_rect.left;
|
||||
int src_h = src_rect.bottom - src_rect.top;
|
||||
|
@ -236,11 +228,6 @@ HRESULT dds_Blt(
|
|||
|
||||
if (dst_buf && (dwFlags & DDBLT_COLORFILL) && lpDDBltFx && dst_w > 0 && dst_h > 0)
|
||||
{
|
||||
if (This->bpp == 24)
|
||||
{
|
||||
TRACE_EXT(" NOT_IMPLEMENTED This->bpp=%u, dwFillColor=%08X\n", This->bpp, lpDDBltFx->dwFillColor);
|
||||
}
|
||||
|
||||
blt_colorfill(
|
||||
dst_buf,
|
||||
dst_x,
|
||||
|
@ -264,10 +251,7 @@ HRESULT dds_Blt(
|
|||
BOOL mirror_left_right = got_fx && (lpDDBltFx->dwDDFX & DDBLTFX_MIRRORLEFTRIGHT);
|
||||
BOOL mirror_up_down = got_fx && (lpDDBltFx->dwDDFX & DDBLTFX_MIRRORUPDOWN);
|
||||
|
||||
if (This->bpp != src_surface->bpp ||
|
||||
This->bpp == 24 ||
|
||||
src_surface->bpp == 24 ||
|
||||
(is_stretch_blt && This == src_surface))
|
||||
if (This->bpp != src_surface->bpp || (is_stretch_blt && This == src_surface))
|
||||
{
|
||||
TRACE_EXT(" NOT_IMPLEMENTED This->bpp=%u, src_surface->bpp=%u\n", This->bpp, src_surface->bpp);
|
||||
|
||||
|
@ -277,13 +261,13 @@ HRESULT dds_Blt(
|
|||
HDC src_dc;
|
||||
dds_GetDC(src_surface, &src_dc);
|
||||
|
||||
if (((dwFlags & DDBLT_KEYSRC) && (src_surface->flags & DDSD_CKSRCBLT)) || (dwFlags & DDBLT_KEYSRCOVERRIDE))
|
||||
if ((dwFlags & DDBLT_KEYSRC) || (dwFlags & DDBLT_KEYSRCOVERRIDE))
|
||||
{
|
||||
UINT color =
|
||||
(dwFlags & DDBLT_KEYSRCOVERRIDE) ?
|
||||
lpDDBltFx->ddckSrcColorkey.dwColorSpaceLowValue : src_surface->color_key.dwColorSpaceLowValue;
|
||||
|
||||
if (src_surface->bpp == 32 || src_surface->bpp == 24)
|
||||
if (src_surface->bpp == 32)
|
||||
{
|
||||
color = color & 0xFFFFFF;
|
||||
}
|
||||
|
@ -335,7 +319,7 @@ HRESULT dds_Blt(
|
|||
*/
|
||||
}
|
||||
else if (
|
||||
((dwFlags & DDBLT_KEYSRC) && (src_surface->flags & DDSD_CKSRCBLT)) ||
|
||||
(dwFlags & DDBLT_KEYSRC) ||
|
||||
(dwFlags & DDBLT_KEYSRCOVERRIDE) ||
|
||||
mirror_left_right ||
|
||||
mirror_up_down)
|
||||
|
@ -447,7 +431,6 @@ HRESULT dds_Blt(
|
|||
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && g_ddraw.ref && g_ddraw.render.run)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.surface_updated, TRUE);
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
|
||||
if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->last_flip_tick + FLIP_REDRAW_TIMEOUT < timeGetTime())
|
||||
{
|
||||
|
@ -456,7 +439,7 @@ HRESULT dds_Blt(
|
|||
ReleaseSemaphore(g_ddraw.render.sem, 1, NULL);
|
||||
SwitchToThread();
|
||||
|
||||
if (g_ddraw.ticks_limiter.tick_length > 0 && g_config.limiter_type != LIMIT_PEEKMESSAGE)
|
||||
if (g_ddraw.ticks_limiter.tick_length > 0)
|
||||
{
|
||||
g_ddraw.ticks_limiter.dds_unlock_limiter_disabled = TRUE;
|
||||
util_limit_game_ticks();
|
||||
|
@ -482,10 +465,7 @@ HRESULT dds_BltFast(
|
|||
RECT src_rect = { 0, 0, src_surface ? src_surface->width : 0, src_surface ? src_surface->height : 0 };
|
||||
|
||||
if (lpSrcRect && src_surface)
|
||||
{
|
||||
//dbg_print_rect("lpSrcRect", lpSrcRect);
|
||||
src_rect = *lpSrcRect;
|
||||
}
|
||||
memcpy(&src_rect, lpSrcRect, sizeof(src_rect));
|
||||
|
||||
int dst_x = dwX;
|
||||
int dst_y = dwY;
|
||||
|
@ -569,9 +549,7 @@ HRESULT dds_BltFast(
|
|||
|
||||
if (src_surface && dst_w > 0 && dst_h > 0)
|
||||
{
|
||||
if (This->bpp != src_surface->bpp ||
|
||||
This->bpp == 24 ||
|
||||
src_surface->bpp == 24)
|
||||
if (This->bpp != src_surface->bpp)
|
||||
{
|
||||
TRACE_EXT(" NOT_IMPLEMENTED This->bpp=%u, src_surface->bpp=%u\n", This->bpp, src_surface->bpp);
|
||||
|
||||
|
@ -581,11 +559,11 @@ HRESULT dds_BltFast(
|
|||
HDC src_dc;
|
||||
dds_GetDC(src_surface, &src_dc);
|
||||
|
||||
if ((dwFlags & DDBLTFAST_SRCCOLORKEY) && (src_surface->flags & DDSD_CKSRCBLT))
|
||||
if (dwFlags & DDBLTFAST_SRCCOLORKEY)
|
||||
{
|
||||
UINT color = src_surface->color_key.dwColorSpaceLowValue;
|
||||
|
||||
if (src_surface->bpp == 32 || src_surface->bpp == 24)
|
||||
if (src_surface->bpp == 32)
|
||||
{
|
||||
color = color & 0xFFFFFF;
|
||||
}
|
||||
|
@ -634,7 +612,7 @@ HRESULT dds_BltFast(
|
|||
SRCCOPY);
|
||||
*/
|
||||
}
|
||||
else if ((dwFlags & DDBLTFAST_SRCCOLORKEY) && (src_surface->flags & DDSD_CKSRCBLT))
|
||||
else if (dwFlags & DDBLTFAST_SRCCOLORKEY)
|
||||
{
|
||||
blt_colorkey(
|
||||
dst_buf,
|
||||
|
@ -686,7 +664,6 @@ HRESULT dds_BltFast(
|
|||
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && g_ddraw.ref && g_ddraw.render.run)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.surface_updated, TRUE);
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
|
||||
DWORD time = timeGetTime();
|
||||
|
||||
|
@ -733,7 +710,8 @@ HRESULT dds_GetSurfaceDesc(IDirectDrawSurfaceImpl* This, LPDDSURFACEDESC lpDDSur
|
|||
DDSD_WIDTH |
|
||||
DDSD_HEIGHT |
|
||||
DDSD_PITCH |
|
||||
DDSD_PIXELFORMAT;
|
||||
DDSD_PIXELFORMAT |
|
||||
DDSD_LPSURFACE;
|
||||
|
||||
lpDDSurfaceDesc->dwWidth = This->width;
|
||||
lpDDSurfaceDesc->dwHeight = This->height;
|
||||
|
@ -767,7 +745,7 @@ HRESULT dds_GetSurfaceDesc(IDirectDrawSurfaceImpl* This, LPDDSURFACEDESC lpDDSur
|
|||
lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x07E0;
|
||||
lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x001F;
|
||||
}
|
||||
else if (This->bpp == 32 || This->bpp == 24)
|
||||
else if (This->bpp == 32)
|
||||
{
|
||||
lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0xFF0000;
|
||||
lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x00FF00;
|
||||
|
@ -844,7 +822,6 @@ HRESULT dds_Flip(IDirectDrawSurfaceImpl* This, IDirectDrawSurfaceImpl* lpDDSurfa
|
|||
This->last_flip_tick = timeGetTime();
|
||||
|
||||
InterlockedExchange(&g_ddraw.render.surface_updated, TRUE);
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
ReleaseSemaphore(g_ddraw.render.sem, 1, NULL);
|
||||
SwitchToThread();
|
||||
|
||||
|
@ -853,7 +830,7 @@ HRESULT dds_Flip(IDirectDrawSurfaceImpl* This, IDirectDrawSurfaceImpl* lpDDSurfa
|
|||
dd_WaitForVerticalBlank(DDWAITVB_BLOCKEND, NULL);
|
||||
}
|
||||
|
||||
if (g_ddraw.ticks_limiter.tick_length > 0 && g_config.limiter_type != LIMIT_PEEKMESSAGE)
|
||||
if (g_ddraw.ticks_limiter.tick_length > 0)
|
||||
{
|
||||
g_ddraw.ticks_limiter.dds_unlock_limiter_disabled = TRUE;
|
||||
util_limit_game_ticks();
|
||||
|
@ -909,11 +886,6 @@ HRESULT dds_GetClipper(IDirectDrawSurfaceImpl* This, IDirectDrawClipperImpl** lp
|
|||
|
||||
HRESULT dds_GetColorKey(IDirectDrawSurfaceImpl* This, DWORD dwFlags, LPDDCOLORKEY lpColorKey)
|
||||
{
|
||||
if (!(This->flags & DDSD_CKSRCBLT))
|
||||
{
|
||||
return DDERR_NOCOLORKEY;
|
||||
}
|
||||
|
||||
if (dwFlags != DDCKEY_SRCBLT || !lpColorKey)
|
||||
{
|
||||
TRACE(" NOT_IMPLEMENTED dwFlags=%08X, lpColorKey=%p\n", dwFlags, lpColorKey);
|
||||
|
@ -954,8 +926,7 @@ HRESULT dds_GetDC(IDirectDrawSurfaceImpl* This, HDC FAR* lpHDC)
|
|||
if (lpHDC)
|
||||
*lpHDC = dc;
|
||||
|
||||
if (!(This->caps & DDSCAPS_OWNDC))
|
||||
InterlockedExchange((LONG*)&This->dc_state, SaveDC(dc));
|
||||
InterlockedExchange((LONG*)&This->dc_state, SaveDC(dc));
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
@ -998,7 +969,7 @@ HRESULT dds_GetPixelFormat(IDirectDrawSurfaceImpl* This, LPDDPIXELFORMAT ddpfPix
|
|||
ddpfPixelFormat->dwGBitMask = 0x07E0;
|
||||
ddpfPixelFormat->dwBBitMask = 0x001F;
|
||||
}
|
||||
else if (This->bpp == 32 || This->bpp == 24)
|
||||
else if (This->bpp == 32)
|
||||
{
|
||||
ddpfPixelFormat->dwRBitMask = 0xFF0000;
|
||||
ddpfPixelFormat->dwGBitMask = 0x00FF00;
|
||||
|
@ -1023,7 +994,17 @@ HRESULT dds_Lock(
|
|||
|
||||
dbg_dump_dds_lock_flags(dwFlags);
|
||||
|
||||
util_pull_messages();
|
||||
if (g_config.fixnotresponding &&
|
||||
g_ddraw.hwnd &&
|
||||
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
|
||||
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
|
||||
!IsWine())
|
||||
{
|
||||
/* workaround for "Not Responding" window problem */
|
||||
g_ddraw.last_msg_pull_tick = timeGetTime();
|
||||
MSG msg;
|
||||
real_PeekMessageA(&msg, g_ddraw.hwnd, 0, 0, PM_NOREMOVE | PM_QS_INPUT);
|
||||
}
|
||||
|
||||
HRESULT ret = dds_GetSurfaceDesc(This, lpDDSurfaceDesc);
|
||||
|
||||
|
@ -1053,7 +1034,6 @@ HRESULT dds_ReleaseDC(IDirectDrawSurfaceImpl* This, HDC hDC)
|
|||
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && g_ddraw.ref && g_ddraw.render.run)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.surface_updated, TRUE);
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
|
||||
DWORD time = timeGetTime();
|
||||
|
||||
|
@ -1064,8 +1044,7 @@ HRESULT dds_ReleaseDC(IDirectDrawSurfaceImpl* This, HDC hDC)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(This->caps & DDSCAPS_OWNDC))
|
||||
RestoreDC(hDC, InterlockedExchangeAdd((LONG*)&This->dc_state, 0));
|
||||
RestoreDC(hDC, InterlockedExchangeAdd((LONG*)&This->dc_state, 0));
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
@ -1119,13 +1098,11 @@ HRESULT dds_SetColorKey(IDirectDrawSurfaceImpl* This, DWORD dwFlags, LPDDCOLORKE
|
|||
|
||||
HRESULT dds_SetPalette(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* lpDDPalette)
|
||||
{
|
||||
if (This->bpp != 8)
|
||||
return DDERR_INVALIDPIXELFORMAT;
|
||||
|
||||
if (lpDDPalette)
|
||||
IDirectDrawPalette_AddRef(lpDDPalette);
|
||||
|
||||
IDirectDrawPaletteImpl* old_palette = This->palette;
|
||||
if (This->palette)
|
||||
IDirectDrawPalette_Release(This->palette);
|
||||
|
||||
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && g_ddraw.ref)
|
||||
{
|
||||
|
@ -1144,9 +1121,6 @@ HRESULT dds_SetPalette(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* lpD
|
|||
This->palette = lpDDPalette;
|
||||
}
|
||||
|
||||
if (old_palette)
|
||||
IDirectDrawPalette_Release(old_palette);
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1213,6 @@ HRESULT dds_Unlock(IDirectDrawSurfaceImpl* This, LPRECT lpRect)
|
|||
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && g_ddraw.ref && g_ddraw.render.run)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.surface_updated, TRUE);
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
|
||||
DWORD time = timeGetTime();
|
||||
|
||||
|
@ -1249,7 +1222,6 @@ HRESULT dds_Unlock(IDirectDrawSurfaceImpl* This, LPRECT lpRect)
|
|||
ReleaseSemaphore(g_ddraw.render.sem, 1, NULL);
|
||||
|
||||
if (g_ddraw.ticks_limiter.tick_length > 0 &&
|
||||
g_config.limiter_type != LIMIT_PEEKMESSAGE &&
|
||||
(!g_ddraw.ticks_limiter.dds_unlock_limiter_disabled || g_config.limiter_type == LIMIT_UNLOCK))
|
||||
{
|
||||
util_limit_game_ticks();
|
||||
|
@ -1329,8 +1301,7 @@ HRESULT dds_SetSurfaceDesc(IDirectDrawSurfaceImpl* This, LPDDSURFACEDESC2 lpDDSD
|
|||
This->bpp = 16;
|
||||
break;
|
||||
case 24:
|
||||
This->bpp = 24;
|
||||
break;
|
||||
TRACE(" NOT_IMPLEMENTED bpp=%u\n", lpDDSD->ddpfPixelFormat.dwRGBBitCount);
|
||||
case 32:
|
||||
This->bpp = 32;
|
||||
break;
|
||||
|
@ -1443,8 +1414,7 @@ HRESULT dd_CreateSurface(
|
|||
dst_surface->bpp = 16;
|
||||
break;
|
||||
case 24:
|
||||
dst_surface->bpp = 24;
|
||||
break;
|
||||
TRACE(" NOT_IMPLEMENTED bpp=%u\n", lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount);
|
||||
case 32:
|
||||
dst_surface->bpp = 32;
|
||||
break;
|
||||
|
@ -1498,24 +1468,21 @@ HRESULT dd_CreateSurface(
|
|||
|
||||
DWORD aligned_width = dst_surface->pitch / dst_surface->bytes_pp;
|
||||
|
||||
DWORD bmi_size = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256;
|
||||
DWORD bmp_size = dst_surface->pitch * (dst_surface->height + g_config.guard_lines);
|
||||
|
||||
dst_surface->bmi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DDBITMAPINFO));
|
||||
dst_surface->bmi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bmi_size);
|
||||
dst_surface->bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dst_surface->bmi->bmiHeader.biWidth = aligned_width;
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height + g_config.guard_lines);
|
||||
dst_surface->bmi->bmiHeader.biPlanes = 1;
|
||||
dst_surface->bmi->bmiHeader.biBitCount = dst_surface->bpp;
|
||||
dst_surface->bmi->bmiHeader.biCompression = dst_surface->bpp == 16 ? BI_BITFIELDS : BI_RGB;
|
||||
dst_surface->bmi->bmiHeader.biCompression = dst_surface->bpp == 8 ? BI_RGB : BI_BITFIELDS;
|
||||
|
||||
WORD clr_bits = (WORD)(dst_surface->bmi->bmiHeader.biPlanes * dst_surface->bmi->bmiHeader.biBitCount);
|
||||
|
||||
dst_surface->bmi->bmiHeader.biClrUsed =
|
||||
dst_surface->bpp == 8 ? 256 :
|
||||
dst_surface->bpp == 16 ? 3 :
|
||||
dst_surface->bpp == 24 ? 0 :
|
||||
dst_surface->bpp == 32 ? 0 :
|
||||
0;
|
||||
dst_surface->bmi->bmiHeader.biClrUsed =
|
||||
dst_surface->bmi->bmiHeader.biCompression == BI_BITFIELDS ? 3 : (1 << clr_bits);
|
||||
|
||||
dst_surface->bmi->bmiHeader.biSizeImage =
|
||||
((aligned_width * clr_bits + 63) & ~63) / 8 * dst_surface->height;
|
||||
|
@ -1542,9 +1509,15 @@ HRESULT dd_CreateSurface(
|
|||
((DWORD*)dst_surface->bmi->bmiColors)[1] = 0x07E0;
|
||||
((DWORD*)dst_surface->bmi->bmiColors)[2] = 0x001F;
|
||||
}
|
||||
else if (dst_surface->bpp == 32)
|
||||
{
|
||||
((DWORD*)dst_surface->bmi->bmiColors)[0] = 0xFF0000;
|
||||
((DWORD*)dst_surface->bmi->bmiColors)[1] = 0x00FF00;
|
||||
((DWORD*)dst_surface->bmi->bmiColors)[2] = 0x0000FF;
|
||||
}
|
||||
|
||||
/* Claw hack: 128x128 surfaces need a DC for custom levels to work properly */
|
||||
if ((!g_config.limit_gdi_handles && InterlockedExchangeAdd(&g_dds_gdi_handles, 0) < 9000) ||
|
||||
if (InterlockedExchangeAdd(&g_dds_gdi_handles, 0) < 4000 ||
|
||||
(dst_surface->width == g_ddraw.width && dst_surface->height == g_ddraw.height) ||
|
||||
(dst_surface->width == 128 && dst_surface->height == 128))
|
||||
{
|
||||
|
@ -1553,18 +1526,17 @@ HRESULT dd_CreateSurface(
|
|||
if (dst_surface->hdc)
|
||||
InterlockedIncrement(&g_dds_gdi_handles);
|
||||
|
||||
// CreateDIBSection cannot handle values higher than a WORD - 0xFF00 (guard lines);
|
||||
DWORD map_offset = min(65280, dst_surface->pitch * g_config.guard_lines);
|
||||
|
||||
dst_surface->mapping =
|
||||
CreateFileMappingA(
|
||||
INVALID_HANDLE_VALUE,
|
||||
NULL,
|
||||
PAGE_READWRITE | SEC_COMMIT,
|
||||
0,
|
||||
bmp_size + 256 + map_offset,
|
||||
bmp_size + 256,
|
||||
NULL);
|
||||
|
||||
DWORD map_offset = 0;
|
||||
|
||||
if (dst_surface->mapping)
|
||||
{
|
||||
LPVOID data = MapViewOfFile(dst_surface->mapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
|
||||
|
@ -1610,16 +1582,6 @@ HRESULT dd_CreateSurface(
|
|||
{
|
||||
g_ddraw.primary = dst_surface;
|
||||
FakePrimarySurface = dst_surface->surface;
|
||||
|
||||
if (dst_surface->bpp == 8)
|
||||
{
|
||||
IDirectDrawPaletteImpl* lpDDPalette;
|
||||
dd_CreatePalette(DDPCAPS_ALLOW256, g_ddp_default_palette, &lpDDPalette, NULL);
|
||||
dds_SetPalette(dst_surface, lpDDPalette);
|
||||
|
||||
// Make sure temp palette will be released once replaced
|
||||
IDirectDrawPalette_Release(lpDDPalette);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
257
src/debug.c
257
src/debug.c
|
@ -2,8 +2,6 @@
|
|||
#include <dbghelp.h>
|
||||
#include <stdio.h>
|
||||
#include <d3d9.h>
|
||||
#include <time.h>
|
||||
#include "directinput.h"
|
||||
#include "ddraw.h"
|
||||
#include "dd.h"
|
||||
#include "ddsurface.h"
|
||||
|
@ -13,17 +11,11 @@
|
|||
#include "version.h"
|
||||
#include "git.h"
|
||||
#include "versionhelpers.h"
|
||||
#include "utils.h"
|
||||
#include "crc32.h"
|
||||
#include "dllmain.h"
|
||||
#include "config.h"
|
||||
#include "delay_imports.h"
|
||||
|
||||
|
||||
double g_dbg_frame_time = 0;
|
||||
DWORD g_dbg_frame_count = 0;
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER g_dbg_exception_filter;
|
||||
PVOID g_dbg_exception_handle;
|
||||
|
||||
static LONGLONG g_dbg_counter_start_time = 0;
|
||||
static double g_dbg_counter_freq = 0.0;
|
||||
|
@ -42,47 +34,33 @@ LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception)
|
|||
{
|
||||
g_dbg_crash_count++;
|
||||
|
||||
BOOL(WINAPI * MiniDumpWriteDumpProc)(
|
||||
HANDLE,
|
||||
DWORD,
|
||||
HANDLE,
|
||||
MINIDUMP_TYPE,
|
||||
PMINIDUMP_EXCEPTION_INFORMATION,
|
||||
PMINIDUMP_USER_STREAM_INFORMATION,
|
||||
PMINIDUMP_CALLBACK_INFORMATION
|
||||
);
|
||||
HANDLE dmp =
|
||||
CreateFile(
|
||||
g_dbg_crash_count == 1 ? g_dbg_dmp_path1 : g_dbg_dmp_path2,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE | FILE_SHARE_READ,
|
||||
0,
|
||||
CREATE_ALWAYS,
|
||||
0,
|
||||
0);
|
||||
|
||||
MiniDumpWriteDumpProc = (void*)real_GetProcAddress(real_LoadLibraryA("Dbghelp.dll"), "MiniDumpWriteDump");
|
||||
if (MiniDumpWriteDumpProc)
|
||||
if (dmp != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HANDLE dmp =
|
||||
CreateFile(
|
||||
g_dbg_crash_count == 1 ? g_dbg_dmp_path1 : g_dbg_dmp_path2,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE | FILE_SHARE_READ,
|
||||
0,
|
||||
CREATE_ALWAYS,
|
||||
0,
|
||||
0);
|
||||
MINIDUMP_EXCEPTION_INFORMATION info;
|
||||
info.ThreadId = GetCurrentThreadId();
|
||||
info.ExceptionPointers = exception;
|
||||
info.ClientPointers = TRUE;
|
||||
|
||||
if (dmp != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
MINIDUMP_EXCEPTION_INFORMATION info;
|
||||
info.ThreadId = GetCurrentThreadId();
|
||||
info.ExceptionPointers = exception;
|
||||
info.ClientPointers = TRUE;
|
||||
MiniDumpWriteDump(
|
||||
GetCurrentProcess(),
|
||||
GetCurrentProcessId(),
|
||||
dmp,
|
||||
0,
|
||||
&info,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
MiniDumpWriteDumpProc(
|
||||
GetCurrentProcess(),
|
||||
GetCurrentProcessId(),
|
||||
dmp,
|
||||
0,
|
||||
&info,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
CloseHandle(dmp);
|
||||
}
|
||||
CloseHandle(dmp);
|
||||
}
|
||||
|
||||
if (exception && exception->ExceptionRecord)
|
||||
|
@ -90,13 +68,15 @@ LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception)
|
|||
HMODULE mod = NULL;
|
||||
char filename[MAX_PATH] = { 0 };
|
||||
|
||||
if (delay_GetModuleHandleExA && delay_GetModuleHandleExA(
|
||||
#if defined(_MSC_VER) /* comment this out just to keep the mingw build win2000 compatible */
|
||||
if (GetModuleHandleExA(
|
||||
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
exception->ExceptionRecord->ExceptionAddress,
|
||||
&mod))
|
||||
{
|
||||
GetModuleFileNameA(mod, filename, sizeof(filename) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE(
|
||||
"Exception at %p (%p+%p), Code=%08X - %s\n",
|
||||
|
@ -130,48 +110,6 @@ void __cdecl dbg_invoke_watson(
|
|||
}
|
||||
#endif
|
||||
|
||||
LONG WINAPI dbg_vectored_exception_handler(EXCEPTION_POINTERS* exception)
|
||||
{
|
||||
if (exception &&
|
||||
exception->ContextRecord &&
|
||||
exception->ExceptionRecord &&
|
||||
exception->ExceptionRecord->ExceptionAddress &&
|
||||
exception->ExceptionRecord->ExceptionCode == STATUS_PRIVILEGED_INSTRUCTION)
|
||||
{
|
||||
size_t size = 0;
|
||||
BYTE* addr = exception->ExceptionRecord->ExceptionAddress;
|
||||
switch (*addr)
|
||||
{
|
||||
case 0xE4: // IN ib
|
||||
case 0xE5: // IN id
|
||||
case 0xE6: // OUT ib
|
||||
case 0xE7: // OUT ib
|
||||
size = 2;
|
||||
break;
|
||||
case 0xF8: // CLC
|
||||
case 0xF9: // STC
|
||||
case 0xFA: // CLI
|
||||
case 0xFB: // STI
|
||||
case 0xFC: // CLD
|
||||
case 0xFD: // STD
|
||||
case 0xEC: // IN ib
|
||||
case 0xED: // IN id
|
||||
case 0xEE: // OUT
|
||||
case 0xEF: // OUT
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (size)
|
||||
{
|
||||
exception->ContextRecord->Eip += size;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
}
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
void dbg_init()
|
||||
{
|
||||
static BOOL once = 0;
|
||||
|
@ -213,55 +151,36 @@ void dbg_init()
|
|||
}
|
||||
|
||||
TRACE(
|
||||
"cnc-ddraw version = %d.%d.%d.%d (git~%s, %s)\n",
|
||||
VERSION_MAJOR,
|
||||
VERSION_MINOR,
|
||||
VERSION_BUILD,
|
||||
VERSION_REVISION,
|
||||
"cnc-ddraw version = %d.%d.%d.%d (git~%s, %s)\n",
|
||||
VERSION_MAJOR,
|
||||
VERSION_MINOR,
|
||||
VERSION_BUILD,
|
||||
VERSION_REVISION,
|
||||
GIT_COMMIT,
|
||||
GIT_BRANCH);
|
||||
|
||||
TRACE("cnc-ddraw = %p\n", g_ddraw_module);
|
||||
|
||||
HKEY hkey = NULL;
|
||||
HKEY hkey;
|
||||
LONG status =
|
||||
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0L, KEY_READ, &hkey);
|
||||
|
||||
HKEY hkey9x = NULL;
|
||||
LONG status9x =
|
||||
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0L, KEY_READ, &hkey9x);
|
||||
|
||||
char name[256] = { 0 };
|
||||
DWORD name_size = sizeof(name);
|
||||
if (status || RegQueryValueExA(hkey, "ProductName", NULL, NULL, (PVOID)&name, &name_size) != ERROR_SUCCESS)
|
||||
{
|
||||
if (status9x == ERROR_SUCCESS)
|
||||
RegQueryValueExA(hkey9x, "ProductName", NULL, NULL, (PVOID)&name, &name_size);
|
||||
}
|
||||
|
||||
char vers[256] = { 0 };
|
||||
DWORD vers_size = sizeof(vers);
|
||||
if (status || RegQueryValueExA(hkey, "DisplayVersion", NULL, NULL, (PVOID)&vers, &vers_size) != ERROR_SUCCESS)
|
||||
{
|
||||
if (status9x == ERROR_SUCCESS)
|
||||
RegQueryValueExA(hkey9x, "VersionNumber", NULL, NULL, (PVOID)&vers, &vers_size);
|
||||
}
|
||||
|
||||
char build[256] = { 0 };
|
||||
DWORD build_size = sizeof(build);
|
||||
if (status || RegQueryValueExA(hkey, "BuildLabEx", NULL, NULL, (PVOID)&build, &build_size) != ERROR_SUCCESS)
|
||||
{
|
||||
if (status == ERROR_SUCCESS)
|
||||
RegQueryValueExA(hkey, "BuildLab", NULL, NULL, (PVOID)&build, &build_size);
|
||||
}
|
||||
|
||||
TRACE("%s %s (%s)\n", name, vers, build);
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
RegCloseKey(hkey);
|
||||
{
|
||||
char name[256] = { 0 };
|
||||
DWORD name_size = sizeof(name);
|
||||
RegQueryValueExA(hkey, "ProductName", NULL, NULL, (PVOID)&name, &name_size);
|
||||
|
||||
if (status9x == ERROR_SUCCESS)
|
||||
RegCloseKey(hkey9x);
|
||||
char dversion[256] = { 0 };
|
||||
DWORD dversion_size = sizeof(dversion);
|
||||
RegQueryValueExA(hkey, "DisplayVersion", NULL, NULL, (PVOID)&dversion, &dversion_size);
|
||||
|
||||
char build[256] = { 0 };
|
||||
DWORD build_size = sizeof(build);
|
||||
RegQueryValueExA(hkey, "BuildLab", NULL, NULL, (PVOID)&build, &build_size);
|
||||
|
||||
TRACE("%s %s (%s)\n", name, dversion, build);
|
||||
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
if (IsWine())
|
||||
{
|
||||
|
@ -273,14 +192,6 @@ void dbg_init()
|
|||
|
||||
TRACE("Wine sysname = %s, release = %s\n", sysname, release);
|
||||
}
|
||||
|
||||
TRACE("crc32 = %08X\n", Crc32_FromFile(0, exe_path));
|
||||
|
||||
DWORD timestamp = util_get_timestamp(GetModuleHandleA(NULL));
|
||||
if (timestamp)
|
||||
{
|
||||
TRACE("timestamp = %s", asctime(_gmtime32((const long*)×tamp)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1091,78 +1002,6 @@ void dbg_dump_dds_lock_flags(DWORD flags)
|
|||
#endif
|
||||
}
|
||||
|
||||
void dbg_dump_di_scm_flags(DWORD flags)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (flags & DISCL_EXCLUSIVE) {
|
||||
TRACE(" DISCL_EXCLUSIVE\n");
|
||||
}
|
||||
if (flags & DISCL_NONEXCLUSIVE) {
|
||||
TRACE(" DISCL_NONEXCLUSIVE\n");
|
||||
}
|
||||
if (flags & DISCL_FOREGROUND) {
|
||||
TRACE(" DISCL_FOREGROUND\n");
|
||||
}
|
||||
if (flags & DISCL_BACKGROUND) {
|
||||
TRACE(" DISCL_BACKGROUND\n");
|
||||
}
|
||||
if (flags & DISCL_NOWINKEY) {
|
||||
TRACE(" DISCL_NOWINKEY\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dbg_dump_hook_type(int idHook)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (idHook == 0) {
|
||||
TRACE(" WH_JOURNALRECORD\n");
|
||||
}
|
||||
if (idHook == 1) {
|
||||
TRACE(" WH_JOURNALPLAYBACK\n");
|
||||
}
|
||||
if (idHook == 2) {
|
||||
TRACE(" WH_KEYBOARD\n");
|
||||
}
|
||||
if (idHook == 3) {
|
||||
TRACE(" WH_GETMESSAGE\n");
|
||||
}
|
||||
if (idHook == 4) {
|
||||
TRACE(" WH_CALLWNDPROC\n");
|
||||
}
|
||||
if (idHook == 5) {
|
||||
TRACE(" WH_CBT\n");
|
||||
}
|
||||
if (idHook == 6) {
|
||||
TRACE(" WH_SYSMSGFILTER\n");
|
||||
}
|
||||
if (idHook == 7) {
|
||||
TRACE(" WH_MOUSE\n");
|
||||
}
|
||||
if (idHook == 9) {
|
||||
TRACE(" WH_DEBUG\n");
|
||||
}
|
||||
if (idHook == 10) {
|
||||
TRACE(" WH_SHELL\n");
|
||||
}
|
||||
if (idHook == 11) {
|
||||
TRACE(" WH_FOREGROUNDIDLE\n");
|
||||
}
|
||||
if (idHook == 12) {
|
||||
TRACE(" WH_CALLWNDPROCRET\n");
|
||||
}
|
||||
if (idHook == 13) {
|
||||
TRACE(" WH_KEYBOARD_LL\n");
|
||||
}
|
||||
if (idHook == 14) {
|
||||
TRACE(" WH_MOUSE_LL\n");
|
||||
}
|
||||
if (idHook == -1) {
|
||||
TRACE(" WH_MSGFILTER\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
char* dbg_d3d9_hr_to_str(HRESULT hr)
|
||||
{
|
||||
#define HR_TO_STR(x) if (x == hr) return #x
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include "versionhelpers.h"
|
||||
#include "delay_imports.h"
|
||||
|
||||
NTQUERYINFORMATIONTHREADPROC delay_NtQueryInformationThread;
|
||||
RTLVERIFYVERSIONINFOPROC delay_RtlVerifyVersionInfo;
|
||||
WINE_GET_VERSIONPROC delay_wine_get_version;
|
||||
WINE_GET_HOST_VERSIONPROC delay_wine_get_host_version;
|
||||
|
||||
VERSETCONDITIONMASKPROC delay_VerSetConditionMask;
|
||||
GETMODULEHANDLEEXAPROC delay_GetModuleHandleExA;
|
||||
|
||||
void delay_imports_init()
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA("ntdll.dll");
|
||||
if (mod)
|
||||
{
|
||||
delay_NtQueryInformationThread = (NTQUERYINFORMATIONTHREADPROC)GetProcAddress(mod, "NtQueryInformationThread");
|
||||
delay_RtlVerifyVersionInfo = (RTLVERIFYVERSIONINFOPROC)GetProcAddress(mod, "RtlVerifyVersionInfo");
|
||||
delay_wine_get_version = (WINE_GET_VERSIONPROC)GetProcAddress(mod, "wine_get_version");
|
||||
delay_wine_get_host_version = (WINE_GET_HOST_VERSIONPROC)GetProcAddress(mod, "wine_get_host_version");
|
||||
}
|
||||
|
||||
mod = GetModuleHandleA("Kernel32.dll");
|
||||
if (mod)
|
||||
{
|
||||
delay_VerSetConditionMask = (VERSETCONDITIONMASKPROC)GetProcAddress(mod, "VerSetConditionMask");
|
||||
delay_GetModuleHandleExA = (GETMODULEHANDLEEXAPROC)GetProcAddress(mod, "GetModuleHandleExA");
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@
|
|||
#include "dd.h"
|
||||
#include "mouse.h"
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include "detours.h"
|
||||
|
@ -55,12 +54,10 @@ static PROC hook_func(PROC* org_func, PROC new_func)
|
|||
static HRESULT WINAPI fake_did_SetCooperativeLevel(IDirectInputDeviceA* This, HWND hwnd, DWORD dwFlags)
|
||||
{
|
||||
TRACE("DirectInput SetCooperativeLevel(This=%p, hwnd=%p, dwFlags=0x%08X) [%p]\n", This, hwnd, dwFlags, _ReturnAddress());
|
||||
TRACE(" mouse_device = %s\n", This == g_mouse_device ? "TRUE" : "FALSE");
|
||||
dbg_dump_di_scm_flags(dwFlags);
|
||||
|
||||
if (This == g_mouse_device && (dwFlags & DISCL_EXCLUSIVE))
|
||||
if (This == g_mouse_device && g_ddraw.ref && (dwFlags & DISCL_EXCLUSIVE))
|
||||
{
|
||||
if (g_mouse_locked || g_config.devmode || !g_ddraw.ref)
|
||||
if (g_mouse_locked || g_config.devmode)
|
||||
{
|
||||
while (real_ShowCursor(FALSE) >= 0);
|
||||
}
|
||||
|
@ -87,16 +84,13 @@ static HRESULT WINAPI fake_did_GetDeviceData(
|
|||
pdwInOut,
|
||||
dwFlags,
|
||||
_ReturnAddress());
|
||||
*/
|
||||
|
||||
BOOL block_mouse = This == g_mouse_device && !g_mouse_locked && !g_config.devmode;
|
||||
BOOL in_background = FALSE;//g_ddraw.ref && g_ddraw.hwnd && !util_in_foreground(g_ddraw.hwnd);
|
||||
*/
|
||||
|
||||
HRESULT result = real_did_GetDeviceData(This, cbObjectData, rgdod, pdwInOut, dwFlags);
|
||||
|
||||
if (SUCCEEDED(result))
|
||||
if (SUCCEEDED(result) && This == g_mouse_device && !g_mouse_locked && !g_config.devmode)
|
||||
{
|
||||
if ((block_mouse || in_background) && pdwInOut)
|
||||
if (pdwInOut)
|
||||
{
|
||||
if (rgdod && *pdwInOut > 0 && cbObjectData > 0)
|
||||
{
|
||||
|
@ -114,14 +108,11 @@ static HRESULT WINAPI fake_did_GetDeviceState(IDirectInputDeviceA* This, DWORD c
|
|||
{
|
||||
//TRACE("DirectInput GetDeviceState(This=%p, cbData=%lu, lpvData=%p) [%p]\n", This, cbData, lpvData, _ReturnAddress());
|
||||
|
||||
BOOL block_mouse = This == g_mouse_device && !g_mouse_locked && !g_config.devmode;
|
||||
BOOL in_background = g_ddraw.ref && g_ddraw.hwnd && !util_in_foreground(g_ddraw.hwnd);
|
||||
|
||||
HRESULT result = real_did_GetDeviceState(This, cbData, lpvData);
|
||||
|
||||
if (SUCCEEDED(result))
|
||||
if (SUCCEEDED(result) && This == g_mouse_device && !g_mouse_locked && !g_config.devmode)
|
||||
{
|
||||
if ((block_mouse || in_background) && cbData > 0 && lpvData)
|
||||
if (cbData > 0 && lpvData)
|
||||
{
|
||||
memset(lpvData, 0, cbData);
|
||||
}
|
||||
|
@ -142,14 +133,9 @@ static HRESULT WINAPI fake_di_CreateDevice(
|
|||
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
if (rguid)
|
||||
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid))
|
||||
{
|
||||
TRACE(" GUID = %08X\n", ((GUID*)rguid)->Data1);
|
||||
|
||||
if (IsEqualGUID(&GUID_SysMouse, rguid))
|
||||
{
|
||||
g_mouse_device = *lplpDIDevice;
|
||||
}
|
||||
g_mouse_device = *lplpDIDevice;
|
||||
}
|
||||
|
||||
if (!real_did_SetCooperativeLevel)
|
||||
|
@ -187,14 +173,9 @@ static HRESULT WINAPI fake_di_CreateDeviceEx(
|
|||
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
if (rguid)
|
||||
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid))
|
||||
{
|
||||
TRACE(" GUID = %08X\n", ((GUID*)rguid)->Data1);
|
||||
|
||||
if (IsEqualGUID(&GUID_SysMouse, rguid))
|
||||
{
|
||||
g_mouse_device = *lplpDIDevice;
|
||||
}
|
||||
g_mouse_device = *lplpDIDevice;
|
||||
}
|
||||
|
||||
if (!real_did_SetCooperativeLevel)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "indeo.h"
|
||||
#include "utils.h"
|
||||
#include "versionhelpers.h"
|
||||
#include "delay_imports.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
|
||||
|
||||
/* export for cncnet cnc games */
|
||||
|
@ -24,7 +24,6 @@ PVOID FakePrimarySurface;
|
|||
|
||||
|
||||
HMODULE g_ddraw_module;
|
||||
static BOOL g_screensaver_disabled;
|
||||
|
||||
BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
|
@ -34,9 +33,9 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||
{
|
||||
g_ddraw_module = hDll;
|
||||
|
||||
delay_imports_init();
|
||||
verhelp_init();
|
||||
|
||||
if (GetEnvironmentVariable("cnc_ddraw_config_init", NULL, 0))
|
||||
if (GetEnvironmentVariableW(L"cnc_ddraw_config_init", NULL, 0))
|
||||
{
|
||||
cfg_load();
|
||||
return TRUE;
|
||||
|
@ -44,19 +43,12 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||
|
||||
#ifdef _DEBUG
|
||||
dbg_init();
|
||||
TRACE("cnc-ddraw = %p\n", hDll);
|
||||
g_dbg_exception_filter = real_SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)dbg_exception_handler);
|
||||
#endif
|
||||
|
||||
cfg_load();
|
||||
|
||||
PVOID(WINAPI * add_handler)(ULONG, PVECTORED_EXCEPTION_HANDLER) =
|
||||
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "AddVectoredExceptionHandler");
|
||||
|
||||
if (add_handler)
|
||||
{
|
||||
g_dbg_exception_handle = add_handler(1, (PVECTORED_EXCEPTION_HANDLER)dbg_vectored_exception_handler);
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
|
||||
if (GetEnvironmentVariable("__COMPAT_LAYER", buf, sizeof(buf)))
|
||||
|
@ -75,14 +67,13 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||
|
||||
if (_strcmpi(s, "WIN95") == 0 || _strcmpi(s, "WIN98") == 0 || _strcmpi(s, "NT4SP5") == 0)
|
||||
{
|
||||
char mes[280] = { 0 };
|
||||
char mes[128] = { 0 };
|
||||
|
||||
_snprintf(
|
||||
mes,
|
||||
sizeof(mes) - 1,
|
||||
"Warning: Compatibility modes detected. \n\nIf there are issues with the game then try to "
|
||||
"disable the '%s' compatibility mode for all game executables.\n\n"
|
||||
"Note: You can disable this warning via ddraw.ini -> 'no_compat_warning=true'",
|
||||
"Please disable the '%s' compatibility mode for all game executables and "
|
||||
"then try to start the game again.",
|
||||
s);
|
||||
|
||||
if (!g_config.no_compat_warning)
|
||||
|
@ -133,19 +124,6 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||
set_aware();
|
||||
}
|
||||
|
||||
/* Make sure screensaver will stay off and monitors will stay on */
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
|
||||
|
||||
/* WINE does not support SetThreadExecutionState so we'll have to use SPI_SETSCREENSAVEACTIVE instead */
|
||||
BOOL screensaver_enabled = FALSE;
|
||||
SystemParametersInfoA(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_enabled, 0);
|
||||
|
||||
if (screensaver_enabled)
|
||||
{
|
||||
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
|
||||
g_screensaver_disabled = TRUE;
|
||||
}
|
||||
|
||||
indeo_enable();
|
||||
timeBeginPeriod(1);
|
||||
hook_init();
|
||||
|
@ -153,7 +131,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
if (GetEnvironmentVariable("cnc_ddraw_config_init", NULL, 0))
|
||||
if (GetEnvironmentVariableW(L"cnc_ddraw_config_init", NULL, 0))
|
||||
return TRUE;
|
||||
|
||||
TRACE("cnc-ddraw DLL_PROCESS_DETACH\n");
|
||||
|
@ -163,34 +141,11 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||
indeo_disable();
|
||||
timeEndPeriod(1);
|
||||
keyboard_hook_exit();
|
||||
mouse_hook_exit();
|
||||
dinput_hook_exit();
|
||||
hook_exit();
|
||||
|
||||
SetThreadExecutionState(ES_CONTINUOUS);
|
||||
|
||||
if (g_screensaver_disabled)
|
||||
{
|
||||
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);
|
||||
}
|
||||
|
||||
ULONG(WINAPI* remove_handler)(PVOID) =
|
||||
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "RemoveVectoredExceptionHandler");
|
||||
|
||||
if (g_dbg_exception_handle && remove_handler)
|
||||
remove_handler(g_dbg_exception_handle);
|
||||
|
||||
if (g_config.terminate_process == 2)
|
||||
TerminateProcess(GetCurrentProcess(), 0);
|
||||
|
||||
break;
|
||||
}
|
||||
case DLL_THREAD_ATTACH:
|
||||
{
|
||||
if (g_config.singlecpu && !IsWine() && IsWindows11Version24H2OrGreater())
|
||||
{
|
||||
util_set_thread_affinity(GetCurrentThreadId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -223,7 +178,7 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
|||
|
||||
HRESULT ret;
|
||||
|
||||
if (util_caller_is_ddraw_wrapper(_ReturnAddress()) || g_config.flightsim98_hack)
|
||||
if (util_caller_is_ddraw_wrapper(_ReturnAddress()))
|
||||
{
|
||||
if (lplpDD)
|
||||
*lplpDD = NULL;
|
||||
|
@ -268,7 +223,7 @@ HRESULT WINAPI DirectDrawCreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnk
|
|||
|
||||
HRESULT ret;
|
||||
|
||||
if (util_caller_is_ddraw_wrapper(_ReturnAddress()) || g_config.flightsim98_hack)
|
||||
if (util_caller_is_ddraw_wrapper(_ReturnAddress()))
|
||||
{
|
||||
if (lplpDD)
|
||||
*lplpDD = NULL;
|
||||
|
|
|
@ -120,9 +120,16 @@ BOOL fpsl_wait_for_vblank()
|
|||
|
||||
BOOL fpsl_dwm_flush()
|
||||
{
|
||||
if (g_fpsl.initialized && fpsl_dwm_is_enabled() && g_fpsl.DwmFlush && !IsWine())
|
||||
if (g_fpsl.initialized && fpsl_dwm_is_enabled() && g_fpsl.DwmFlush)
|
||||
{
|
||||
return SUCCEEDED(g_fpsl.DwmFlush());
|
||||
HRESULT x = g_fpsl.DwmFlush();
|
||||
|
||||
if (!SUCCEEDED(x))
|
||||
{
|
||||
//TRACE(" ERROR %s(result=%08X)\n", __FUNCTION__, x);
|
||||
}
|
||||
|
||||
return SUCCEEDED(x);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
90
src/hook.c
90
src/hook.c
|
@ -51,19 +51,12 @@ SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA = SetWindowsHookExA;
|
|||
PEEKMESSAGEAPROC real_PeekMessageA = PeekMessageA;
|
||||
GETMESSAGEAPROC real_GetMessageA = GetMessageA;
|
||||
GETWINDOWPLACEMENTPROC real_GetWindowPlacement = GetWindowPlacement;
|
||||
SETWINDOWPLACEMENTPROC real_SetWindowPlacement = SetWindowPlacement;
|
||||
ENUMDISPLAYSETTINGSAPROC real_EnumDisplaySettingsA = EnumDisplaySettingsA;
|
||||
DEFWINDOWPROCAPROC real_DefWindowProcA = DefWindowProcA;
|
||||
SETPARENTPROC real_SetParent = SetParent;
|
||||
BEGINPAINTPROC real_BeginPaint = BeginPaint;
|
||||
GETKEYSTATEPROC real_GetKeyState = GetKeyState;
|
||||
GETASYNCKEYSTATEPROC real_GetAsyncKeyState = GetAsyncKeyState;
|
||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||
CREATEFONTINDIRECTAPROC real_CreateFontIndirectA = CreateFontIndirectA;
|
||||
CREATEFONTAPROC real_CreateFontA = CreateFontA;
|
||||
GETSYSTEMPALETTEENTRIESPROC real_GetSystemPaletteEntries = GetSystemPaletteEntries;
|
||||
SELECTPALETTEPROC real_SelectPalette = SelectPalette;
|
||||
REALIZEPALETTEPROC real_RealizePalette = RealizePalette;
|
||||
LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
||||
LOADLIBRARYWPROC real_LoadLibraryW = LoadLibraryW;
|
||||
LOADLIBRARYEXAPROC real_LoadLibraryExA = LoadLibraryExA;
|
||||
|
@ -75,13 +68,6 @@ GETVERSIONEXAPROC real_GetVersionExA = GetVersionExA;
|
|||
COCREATEINSTANCEPROC real_CoCreateInstance = CoCreateInstance;
|
||||
MCISENDCOMMANDAPROC real_mciSendCommandA = mciSendCommandA;
|
||||
SETUNHANDLEDEXCEPTIONFILTERPROC real_SetUnhandledExceptionFilter = SetUnhandledExceptionFilter;
|
||||
AVISTREAMGETFRAMEOPENPROC real_AVIStreamGetFrameOpen = AVIStreamGetFrameOpen;
|
||||
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
|
||||
SETWINDOWLONGWPROC real_SetWindowLongW = SetWindowLongW;
|
||||
#else
|
||||
SETWINDOWLONGWPROC real_SetWindowLongW;
|
||||
#endif
|
||||
|
||||
HOOKLIST g_hook_hooklist[] =
|
||||
{
|
||||
|
@ -116,20 +102,11 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "PeekMessageA", (PROC)fake_PeekMessageA, (PROC*)&real_PeekMessageA, 0 },
|
||||
{ "GetMessageA", (PROC)fake_GetMessageA, (PROC*)&real_GetMessageA, 0 },
|
||||
{ "GetWindowPlacement", (PROC)fake_GetWindowPlacement, (PROC*)&real_GetWindowPlacement, 0 },
|
||||
{ "SetWindowPlacement", (PROC)fake_SetWindowPlacement, (PROC*)&real_SetWindowPlacement, 0 },
|
||||
{ "EnumDisplaySettingsA", (PROC)fake_EnumDisplaySettingsA, (PROC*)&real_EnumDisplaySettingsA, 0 },
|
||||
{ "DefWindowProcA", (PROC)fake_DefWindowProcA, (PROC*)&real_DefWindowProcA, 0 },
|
||||
{ "SetParent", (PROC)fake_SetParent, (PROC*)&real_SetParent, 0 },
|
||||
{ "BeginPaint", (PROC)fake_BeginPaint, (PROC*)&real_BeginPaint, 0 },
|
||||
{ "GetKeyState", (PROC)fake_GetKeyState, (PROC*)&real_GetKeyState, 0 },
|
||||
{ "GetAsyncKeyState", (PROC)fake_GetAsyncKeyState, (PROC*)&real_GetAsyncKeyState, 0 },
|
||||
{ "SetForegroundWindow", (PROC)fake_SetForegroundWindow, (PROC*)&real_SetForegroundWindow, 0 },
|
||||
{ "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA, (PROC*)&real_SetWindowsHookExA, 0 },
|
||||
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
|
||||
{ "SetWindowLongW", (PROC)fake_SetWindowLongW, (PROC*)&real_SetWindowLongW, 0 },
|
||||
#endif
|
||||
|
||||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
},
|
||||
|
@ -147,13 +124,6 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Avifil32.dll",
|
||||
{
|
||||
{ "AVIStreamGetFrameOpen", (PROC)fake_AVIStreamGetFrameOpen, (PROC*)&real_AVIStreamGetFrameOpen, 0 },
|
||||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
},
|
||||
{
|
||||
"dinput.dll",
|
||||
{
|
||||
|
@ -178,11 +148,7 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "SetDIBitsToDevice", (PROC)fake_SetDIBitsToDevice, (PROC*)&real_SetDIBitsToDevice, HOOK_SKIP_2 },
|
||||
{ "StretchDIBits", (PROC)fake_StretchDIBits, (PROC*)&real_StretchDIBits, HOOK_SKIP_2 },
|
||||
{ "GetDeviceCaps", (PROC)fake_GetDeviceCaps, (PROC*)&real_GetDeviceCaps, HOOK_LOCAL_ONLY },
|
||||
{ "GetDeviceCaps", (PROC)fake_GetDeviceCaps_system, NULL, HOOK_SYSTEM_ONLY },
|
||||
{ "CreateFontA", (PROC)fake_CreateFontA, (PROC*)&real_CreateFontA, 0 },
|
||||
{ "GetSystemPaletteEntries", (PROC)fake_GetSystemPaletteEntries, (PROC*)&real_GetSystemPaletteEntries, 0 },
|
||||
{ "SelectPalette", (PROC)fake_SelectPalette, (PROC*)&real_SelectPalette, 0 },
|
||||
{ "RealizePalette", (PROC)fake_RealizePalette, (PROC*)&real_RealizePalette, 0 },
|
||||
{ "CreateFontIndirectA", (PROC)fake_CreateFontIndirectA, (PROC*)&real_CreateFontIndirectA, 0 },
|
||||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
|
@ -190,8 +156,8 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{
|
||||
"WING32.DLL",
|
||||
{
|
||||
{ "WinGBitBlt", (PROC)fake_WinGBitBlt, NULL, 0 },
|
||||
{ "WinGStretchBlt", (PROC)fake_WinGStretchBlt, NULL, 0 },
|
||||
{ "WinGBitBlt", (PROC)fake_WinGBitBlt, NULL, HOOK_SKIP_2 },
|
||||
{ "WinGStretchBlt", (PROC)fake_WinGStretchBlt, NULL, HOOK_SKIP_2 },
|
||||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
},
|
||||
|
@ -203,9 +169,9 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "LoadLibraryExA", (PROC)fake_LoadLibraryExA, (PROC*)&real_LoadLibraryExA, HOOK_SKIP_2 },
|
||||
{ "LoadLibraryExW", (PROC)fake_LoadLibraryExW, (PROC*)&real_LoadLibraryExW, HOOK_SKIP_2 },
|
||||
{ "GetProcAddress", (PROC)fake_GetProcAddress, (PROC*)&real_GetProcAddress, HOOK_SKIP_2 },
|
||||
{ "GetDiskFreeSpaceA", (PROC)fake_GetDiskFreeSpaceA, (PROC*)&real_GetDiskFreeSpaceA, 0 },
|
||||
{ "GetVersion", (PROC)fake_GetVersion, (PROC*)&real_GetVersion, 0 },
|
||||
{ "GetVersionExA", (PROC)fake_GetVersionExA, (PROC*)&real_GetVersionExA, 0 },
|
||||
{ "GetDiskFreeSpaceA", (PROC)fake_GetDiskFreeSpaceA, (PROC*)&real_GetDiskFreeSpaceA, HOOK_SKIP_2 },
|
||||
{ "GetVersion", (PROC)fake_GetVersion, (PROC*)&real_GetVersion, HOOK_SKIP_2 },
|
||||
{ "GetVersionExA", (PROC)fake_GetVersionExA, (PROC*)&real_GetVersionExA, HOOK_SKIP_2 },
|
||||
#if defined(_DEBUG) && defined(__GNUC__)
|
||||
{ "SetUnhandledExceptionFilter", (PROC)fake_SetUnhandledExceptionFilter, (PROC*)&real_SetUnhandledExceptionFilter, 0 },
|
||||
#endif
|
||||
|
@ -244,15 +210,17 @@ void hook_patch_obfuscated_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks,
|
|||
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
|
||||
return;
|
||||
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)hmod + (DWORD)dos_header->e_lfanew);
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)dos_header + (DWORD)dos_header->e_lfanew);
|
||||
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
|
||||
return;
|
||||
|
||||
DWORD import_desc_rva = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||
if (!import_desc_rva)
|
||||
DWORD import_desc_size = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size;
|
||||
|
||||
if (import_desc_rva == 0 || import_desc_size == 0)
|
||||
return;
|
||||
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)hmod + import_desc_rva);
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)dos_header + import_desc_rva);
|
||||
|
||||
while (import_desc->FirstThunk)
|
||||
{
|
||||
|
@ -264,13 +232,13 @@ void hook_patch_obfuscated_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks,
|
|||
|
||||
for (int i = 0; hooks[i].module_name[0]; i++)
|
||||
{
|
||||
char* imp_module_name = (char*)((DWORD)hmod + import_desc->Name);
|
||||
char* imp_module_name = (char*)((DWORD)dos_header + import_desc->Name);
|
||||
|
||||
if (_stricmp(imp_module_name, hooks[i].module_name) == 0)
|
||||
{
|
||||
HMODULE cur_mod = GetModuleHandleA(hooks[i].module_name);
|
||||
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)hmod + import_desc->FirstThunk);
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)dos_header + import_desc->FirstThunk);
|
||||
|
||||
while (first_thunk->u1.Function)
|
||||
{
|
||||
|
@ -294,9 +262,6 @@ void hook_patch_obfuscated_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks,
|
|||
if (!is_local && (hooks[i].data[x].flags & HOOK_LOCAL_ONLY))
|
||||
continue;
|
||||
|
||||
if (is_local && (hooks[i].data[x].flags & HOOK_SYSTEM_ONLY))
|
||||
continue;
|
||||
|
||||
if (unhook)
|
||||
{
|
||||
if (first_thunk->u1.Function == (DWORD)hooks[i].data[x].new_function)
|
||||
|
@ -367,15 +332,17 @@ void hook_patch_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks, BOOL is_loc
|
|||
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
|
||||
return;
|
||||
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)hmod + (DWORD)dos_header->e_lfanew);
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)dos_header + (DWORD)dos_header->e_lfanew);
|
||||
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
|
||||
return;
|
||||
|
||||
DWORD import_desc_rva = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||
if (!import_desc_rva)
|
||||
DWORD import_desc_size = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size;
|
||||
|
||||
if (import_desc_rva == 0 || import_desc_size == 0)
|
||||
return;
|
||||
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)hmod + import_desc_rva);
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)dos_header + import_desc_rva);
|
||||
|
||||
while (import_desc->FirstThunk)
|
||||
{
|
||||
|
@ -387,12 +354,12 @@ void hook_patch_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks, BOOL is_loc
|
|||
|
||||
for (int i = 0; hooks[i].module_name[0]; i++)
|
||||
{
|
||||
char* imp_module_name = (char*)((DWORD)hmod + import_desc->Name);
|
||||
char* imp_module_name = (char*)((DWORD)dos_header + import_desc->Name);
|
||||
|
||||
if (_stricmp(imp_module_name, hooks[i].module_name) == 0)
|
||||
{
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)hmod + import_desc->FirstThunk);
|
||||
PIMAGE_THUNK_DATA o_first_thunk = (void*)((DWORD)hmod + import_desc->OriginalFirstThunk);
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)dos_header + import_desc->FirstThunk);
|
||||
PIMAGE_THUNK_DATA o_first_thunk = (void*)((DWORD)dos_header + import_desc->OriginalFirstThunk);
|
||||
|
||||
while (first_thunk->u1.Function)
|
||||
{
|
||||
|
@ -415,9 +382,6 @@ void hook_patch_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks, BOOL is_loc
|
|||
if (!is_local && (hooks[i].data[x].flags & HOOK_LOCAL_ONLY))
|
||||
continue;
|
||||
|
||||
if (is_local && (hooks[i].data[x].flags & HOOK_SYSTEM_ONLY))
|
||||
continue;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
if (util_is_bad_read_ptr((void*)import->Name))
|
||||
continue;
|
||||
|
@ -486,25 +450,27 @@ BOOL hook_got_ddraw_import(HMODULE mod, BOOL check_imported_dlls)
|
|||
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
|
||||
return FALSE;
|
||||
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)mod + (DWORD)dos_header->e_lfanew);
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)dos_header + (DWORD)dos_header->e_lfanew);
|
||||
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
|
||||
return FALSE;
|
||||
|
||||
DWORD import_desc_rva = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||
if (!import_desc_rva)
|
||||
DWORD import_desc_size = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size;
|
||||
|
||||
if (import_desc_rva == 0 || import_desc_size == 0)
|
||||
return FALSE;
|
||||
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)mod + import_desc_rva);
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)dos_header + import_desc_rva);
|
||||
|
||||
while (import_desc->FirstThunk)
|
||||
{
|
||||
if (import_desc->Name)
|
||||
{
|
||||
char* imp_module_name = (char*)((DWORD)mod + import_desc->Name);
|
||||
char* imp_module_name = (char*)((DWORD)dos_header + import_desc->Name);
|
||||
|
||||
if (_stricmp(imp_module_name, "ddraw.dll") == 0)
|
||||
{
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)mod + import_desc->FirstThunk);
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)dos_header + import_desc->FirstThunk);
|
||||
|
||||
if (first_thunk->u1.Function)
|
||||
return TRUE;
|
||||
|
@ -683,8 +649,6 @@ void hook_init()
|
|||
{
|
||||
/* Switch to 3 if we can be sure that ddraw.dll will not be unloaded from the process */
|
||||
g_config.hook = 3;
|
||||
|
||||
TRACE("Switched to hook 3\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,14 +62,6 @@ LRESULT CALLBACK keyboard_hook_proc(int code, WPARAM wParam, LPARAM lParam)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (wParam == g_config.hotkeys.toggle_fullscreen2)
|
||||
{
|
||||
if (key_triggered)
|
||||
util_toggle_fullscreen();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (wParam == g_config.hotkeys.toggle_maximize && alt_down && key_down)
|
||||
{
|
||||
if (key_triggered)
|
||||
|
@ -78,30 +70,17 @@ LRESULT CALLBACK keyboard_hook_proc(int code, WPARAM wParam, LPARAM lParam)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (wParam == g_config.hotkeys.toggle_maximize2)
|
||||
if (wParam == VK_F4 && g_config.homm_hack) /* Heroes of Might and Magic 3 and 4 */
|
||||
{
|
||||
if (key_triggered)
|
||||
util_toggle_maximize();
|
||||
util_toggle_fullscreen();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (wParam == g_config.hotkeys.screenshot)
|
||||
if (wParam == g_config.hotkeys.screenshot && key_released)
|
||||
{
|
||||
// VK_SNAPSHOT does not have a KEYDOWN event...
|
||||
if (g_config.hotkeys.screenshot == VK_SNAPSHOT)
|
||||
{
|
||||
if (key_released)
|
||||
{
|
||||
ss_take_screenshot(g_ddraw.primary);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (key_triggered)
|
||||
{
|
||||
ss_take_screenshot(g_ddraw.primary);
|
||||
return 1;
|
||||
}
|
||||
ss_take_screenshot(g_ddraw.primary);
|
||||
}
|
||||
|
||||
if (wParam == g_config.hotkeys.unlock_cursor1 || wParam == VK_CONTROL)
|
||||
|
|
104
src/mouse.c
104
src/mouse.c
|
@ -1,15 +1,45 @@
|
|||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <math.h>
|
||||
#include "debug.h"
|
||||
#include "winapi_hooks.h"
|
||||
#include "dd.h"
|
||||
#include "hook.h"
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
#include "mouse.h"
|
||||
|
||||
|
||||
BOOL g_mouse_locked;
|
||||
HHOOK g_mouse_hook;
|
||||
HOOKPROC g_mouse_proc;
|
||||
static HHOOK g_mouse_gm_hook;
|
||||
|
||||
void mouse_hook_init()
|
||||
{
|
||||
if (g_mouse_gm_hook && UnhookWindowsHookEx(g_mouse_gm_hook))
|
||||
{
|
||||
g_mouse_gm_hook = NULL;
|
||||
}
|
||||
|
||||
if (!g_ddraw.gui_thread_id)
|
||||
return;
|
||||
|
||||
g_mouse_gm_hook =
|
||||
real_SetWindowsHookExA(
|
||||
WH_GETMESSAGE,
|
||||
mouse_gm_hook_proc,
|
||||
NULL,
|
||||
g_ddraw.gui_thread_id);
|
||||
}
|
||||
|
||||
void mouse_hook_exit()
|
||||
{
|
||||
if (g_mouse_gm_hook)
|
||||
{
|
||||
UnhookWindowsHookEx(g_mouse_gm_hook);
|
||||
}
|
||||
}
|
||||
|
||||
void mouse_lock()
|
||||
{
|
||||
|
@ -83,15 +113,79 @@ void mouse_unlock()
|
|||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK mouse_hook_proc(int Code, WPARAM wParam, LPARAM lParam)
|
||||
LRESULT CALLBACK mouse_gm_hook_proc(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
MSG* msg = (MSG*)lParam;
|
||||
|
||||
if (code < 0 || !g_ddraw.width || !msg || msg->hwnd != g_ddraw.hwnd)
|
||||
return CallNextHookEx(g_mouse_gm_hook, code, wParam, lParam);
|
||||
|
||||
switch (LOWORD(msg->message))
|
||||
{
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_XBUTTONDBLCLK:
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONUP:
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_MOUSEHOVER:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (LOWORD(msg->message) == WM_MOUSEWHEEL)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
|
||||
real_ScreenToClient(g_ddraw.hwnd, &pt);
|
||||
msg->lParam = MAKELPARAM(pt.x, pt.y);
|
||||
}
|
||||
|
||||
int x = max(GET_X_LPARAM(msg->lParam) - g_ddraw.mouse.x_adjust, 0);
|
||||
int y = max(GET_Y_LPARAM(msg->lParam) - g_ddraw.mouse.y_adjust, 0);
|
||||
|
||||
if (g_config.adjmouse)
|
||||
{
|
||||
if (g_config.vhack && !g_config.devmode)
|
||||
{
|
||||
POINT pt = { 0, 0 };
|
||||
fake_GetCursorPos(&pt);
|
||||
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (DWORD)(roundf(x * g_ddraw.mouse.unscale_x));
|
||||
y = (DWORD)(roundf(y * g_ddraw.mouse.unscale_y));
|
||||
}
|
||||
}
|
||||
|
||||
x = min(x, g_ddraw.width - 1);
|
||||
y = min(y, g_ddraw.height - 1);
|
||||
|
||||
msg->lParam = MAKELPARAM(x, y);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CallNextHookEx(g_mouse_gm_hook, code, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK mouse_hook_proc(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (!g_ddraw.ref)
|
||||
return g_mouse_proc(Code, wParam, lParam);
|
||||
return g_mouse_proc(code, wParam, lParam);
|
||||
|
||||
if (Code < 0 || (!g_config.devmode && !g_mouse_locked))
|
||||
return CallNextHookEx(g_mouse_hook, Code, wParam, lParam);
|
||||
if (code < 0 || (!g_config.devmode && !g_mouse_locked))
|
||||
return CallNextHookEx(g_mouse_hook, code, wParam, lParam);
|
||||
|
||||
fake_GetCursorPos(&((MOUSEHOOKSTRUCT*)lParam)->pt);
|
||||
|
||||
return g_mouse_proc(Code, wParam, lParam);
|
||||
return g_mouse_proc(code, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ HMODULE g_oglu_hmodule;
|
|||
BOOL g_oglu_got_version2;
|
||||
BOOL g_oglu_got_version3;
|
||||
char g_oglu_version[128];
|
||||
char g_oglu_version_long[128];
|
||||
|
||||
BOOL oglu_load_dll()
|
||||
{
|
||||
|
@ -202,7 +201,6 @@ void oglu_init()
|
|||
if (glversion)
|
||||
{
|
||||
strncpy(g_oglu_version, glversion, sizeof(g_oglu_version) - 1);
|
||||
strncpy(g_oglu_version_long, glversion, sizeof(g_oglu_version_long) - 1);
|
||||
g_oglu_version[sizeof(g_oglu_version) - 1] = '\0'; /* strncpy fix */
|
||||
strtok(g_oglu_version, " ");
|
||||
}
|
||||
|
@ -233,28 +231,20 @@ void oglu_init()
|
|||
|
||||
BOOL oglu_ext_exists(char* ext, HDC hdc)
|
||||
{
|
||||
BOOL got_num_extensions = FALSE;
|
||||
|
||||
if (glGetIntegerv && glGetStringi)
|
||||
{
|
||||
GLint n = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
|
||||
|
||||
if (glGetError() == GL_NO_ERROR)
|
||||
for (GLint i = 0; i < n; i++)
|
||||
{
|
||||
got_num_extensions = TRUE;
|
||||
char* glext = (char*)glGetStringi(GL_EXTENSIONS, i);
|
||||
|
||||
for (GLint i = 0; i < n; i++)
|
||||
{
|
||||
char* glext = (char*)glGetStringi(GL_EXTENSIONS, i);
|
||||
|
||||
if (glext && strcmp(glext, ext) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
if (glext && strcmp(glext, ext) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_num_extensions)
|
||||
else
|
||||
{
|
||||
char* glext = (char*)glGetString(GL_EXTENSIONS);
|
||||
|
||||
|
|
|
@ -99,17 +99,14 @@ DWORD WINAPI gdi_render_main(void)
|
|||
FillRect(g_ddraw.render.hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
|
||||
}
|
||||
|
||||
int lines_copied = 0;
|
||||
|
||||
if (g_ddraw.bnet_active)
|
||||
{
|
||||
RECT rc = { 0, 0, g_ddraw.render.width, g_ddraw.render.height };
|
||||
FillRect(g_ddraw.render.hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
|
||||
lines_copied = 1;
|
||||
}
|
||||
else if (upscale_hack)
|
||||
{
|
||||
lines_copied = real_StretchDIBits(
|
||||
real_StretchDIBits(
|
||||
g_ddraw.render.hdc,
|
||||
g_ddraw.render.viewport.x,
|
||||
g_ddraw.render.viewport.y,
|
||||
|
@ -127,7 +124,7 @@ DWORD WINAPI gdi_render_main(void)
|
|||
else if (!g_ddraw.child_window_exists &&
|
||||
(g_ddraw.render.width != g_ddraw.width || g_ddraw.render.height != g_ddraw.height))
|
||||
{
|
||||
lines_copied = real_StretchDIBits(
|
||||
real_StretchDIBits(
|
||||
g_ddraw.render.hdc,
|
||||
g_ddraw.render.viewport.x,
|
||||
g_ddraw.render.viewport.y,
|
||||
|
@ -142,8 +139,7 @@ DWORD WINAPI gdi_render_main(void)
|
|||
DIB_RGB_COLORS,
|
||||
SRCCOPY);
|
||||
}
|
||||
|
||||
if (lines_copied == 0 || lines_copied == GDI_ERROR)
|
||||
else
|
||||
{
|
||||
real_SetDIBitsToDevice(
|
||||
g_ddraw.render.hdc,
|
||||
|
|
133
src/render_ogl.c
133
src/render_ogl.c
|
@ -111,8 +111,6 @@ DWORD WINAPI ogl_render_main(void)
|
|||
{
|
||||
GL_CHECK(oglu_init());
|
||||
|
||||
g_ogl.got_error = g_ogl.got_error || (err = glGetError()) != GL_NO_ERROR;
|
||||
|
||||
BOOL got_swap_ctrl;
|
||||
GL_CHECK(got_swap_ctrl = oglu_ext_exists("WGL_EXT_swap_control", g_ogl.hdc));
|
||||
|
||||
|
@ -248,15 +246,6 @@ static void ogl_build_programs()
|
|||
_snprintf(shader_path, sizeof(shader_path) - 1, "%s%s", g_config.dll_path, g_config.shader);
|
||||
}
|
||||
|
||||
/* Hack for Intel HD 4000 driver bug - force default shader */
|
||||
|
||||
if (_stricmp(g_oglu_version_long, "4.0.0 - Build 10.18.10.4252") == 0 ||
|
||||
_stricmp(g_oglu_version_long, "4.0.0 - Build 10.18.10.5161") == 0)
|
||||
{
|
||||
//shader_path[0] = 0;
|
||||
//g_config.shader[0] = 0;
|
||||
}
|
||||
|
||||
/* detect common upscaling shaders and disable them if no upscaling is required */
|
||||
|
||||
BOOL is_upscaler =
|
||||
|
@ -605,10 +594,8 @@ static void ogl_init_shader1_program()
|
|||
glUseProgram(g_ogl.shader1_program);
|
||||
|
||||
GLint vertex_coord_attr_loc = glGetAttribLocation(g_ogl.shader1_program, "VertexCoord");
|
||||
if (vertex_coord_attr_loc == -1) // dosbox staging
|
||||
vertex_coord_attr_loc = glGetAttribLocation(g_ogl.shader1_program, "a_position");
|
||||
|
||||
g_ogl.shader1_tex_coord_attr_loc = glGetAttribLocation(g_ogl.shader1_program, "TexCoord");
|
||||
g_ogl.shader1_frame_count_uni_loc = glGetUniformLocation(g_ogl.shader1_program, "FrameCount");
|
||||
|
||||
glGenBuffers(3, g_ogl.shader1_vbos);
|
||||
|
||||
|
@ -665,13 +652,10 @@ static void ogl_init_shader1_program()
|
|||
glEnableVertexAttribArray(vertex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if (g_ogl.shader1_tex_coord_attr_loc != -1)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_ogl.shader1_vbos[1]);
|
||||
glVertexAttribPointer(g_ogl.shader1_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader1_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_ogl.shader1_vbos[1]);
|
||||
glVertexAttribPointer(g_ogl.shader1_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader1_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ogl.shader1_vbos[2]);
|
||||
static const GLushort indices[] =
|
||||
|
@ -693,44 +677,24 @@ static void ogl_init_shader1_program()
|
|||
output_size[1] = (float)g_ddraw.render.viewport.height;
|
||||
|
||||
GLint loc = glGetUniformLocation(g_ogl.shader1_program, "OutputSize");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "rubyOutputSize");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, output_size);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "TextureSize");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "rubyTextureSize");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, texture_size);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "InputSize");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "rubyInputSize");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, input_size);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "Texture");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "rubyTexture");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 0);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "FrameDirection");
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 1);
|
||||
|
||||
g_ogl.shader1_frame_count_uni_loc = glGetUniformLocation(g_ogl.shader1_program, "FrameCount");
|
||||
if (g_ogl.shader1_frame_count_uni_loc == -1)
|
||||
g_ogl.shader1_frame_count_uni_loc = glGetUniformLocation(g_ogl.shader1_program, "rubyFrameCount");
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "Texture");
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 0);
|
||||
|
||||
const float mvp_matrix[16] = {
|
||||
1,0,0,0,
|
||||
|
@ -738,10 +702,7 @@ static void ogl_init_shader1_program()
|
|||
0,0,1,0,
|
||||
0,0,0,1,
|
||||
};
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader1_program, "MVPMatrix");
|
||||
if (loc != -1)
|
||||
glUniformMatrix4fv(loc, 1, GL_FALSE, mvp_matrix);
|
||||
glUniformMatrix4fv(glGetUniformLocation(g_ogl.shader1_program, "MVPMatrix"), 1, GL_FALSE, mvp_matrix);
|
||||
|
||||
glGenFramebuffers(FBO_COUNT, g_ogl.frame_buffer_id);
|
||||
glGenTextures(FBO_COUNT, g_ogl.frame_buffer_tex_id);
|
||||
|
@ -847,10 +808,8 @@ static void ogl_init_shader2_program()
|
|||
glUseProgram(g_ogl.shader2_program);
|
||||
|
||||
GLint vertex_coord_attr_loc = glGetAttribLocation(g_ogl.shader2_program, "VertexCoord");
|
||||
if (vertex_coord_attr_loc == -1)
|
||||
vertex_coord_attr_loc = glGetAttribLocation(g_ogl.shader2_program, "a_position");
|
||||
|
||||
g_ogl.shader2_tex_coord_attr_loc = glGetAttribLocation(g_ogl.shader2_program, "TexCoord");
|
||||
g_ogl.shader2_frame_count_uni_loc = glGetUniformLocation(g_ogl.shader2_program, "FrameCount");
|
||||
|
||||
glGenBuffers(3, g_ogl.shader2_vbos);
|
||||
|
||||
|
@ -885,13 +844,10 @@ static void ogl_init_shader2_program()
|
|||
glEnableVertexAttribArray(vertex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if (g_ogl.shader2_tex_coord_attr_loc != -1)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_ogl.shader2_vbos[1]);
|
||||
glVertexAttribPointer(g_ogl.shader2_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader2_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_ogl.shader2_vbos[1]);
|
||||
glVertexAttribPointer(g_ogl.shader2_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader2_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ogl.shader2_vbos[2]);
|
||||
static const GLushort indices[] =
|
||||
|
@ -913,37 +869,25 @@ static void ogl_init_shader2_program()
|
|||
output_size[1] = (float)g_ddraw.render.viewport.height;
|
||||
|
||||
GLint loc = glGetUniformLocation(g_ogl.shader2_program, "OutputSize");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "rubyOutputSize");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, output_size);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "TextureSize");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "rubyTextureSize");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, texture_size);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "InputSize");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "rubyInputSize");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, input_size);
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "FrameDirection");
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 1);
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "Texture");
|
||||
if (loc == -1)
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "rubyTexture");
|
||||
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 0);
|
||||
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "PassPrev2Texture");
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 1);
|
||||
|
@ -952,24 +896,13 @@ static void ogl_init_shader2_program()
|
|||
if (loc != -1)
|
||||
glUniform2fv(loc, 1, texture_size);
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "FrameDirection");
|
||||
if (loc != -1)
|
||||
glUniform1i(loc, 1);
|
||||
|
||||
g_ogl.shader2_frame_count_uni_loc = glGetUniformLocation(g_ogl.shader2_program, "FrameCount");
|
||||
if (g_ogl.shader2_frame_count_uni_loc == -1)
|
||||
g_ogl.shader2_frame_count_uni_loc = glGetUniformLocation(g_ogl.shader2_program, "rubyFrameCount");
|
||||
|
||||
const float mvp_matrix[16] = {
|
||||
1,0,0,0,
|
||||
0,1,0,0,
|
||||
0,0,1,0,
|
||||
0,0,0,1,
|
||||
};
|
||||
|
||||
loc = glGetUniformLocation(g_ogl.shader2_program, "MVPMatrix");
|
||||
if (loc != -1)
|
||||
glUniformMatrix4fv(loc, 1, GL_FALSE, mvp_matrix);
|
||||
glUniformMatrix4fv(glGetUniformLocation(g_ogl.shader2_program, "MVPMatrix"), 1, GL_FALSE, mvp_matrix);
|
||||
}
|
||||
|
||||
static void ogl_render()
|
||||
|
@ -990,11 +923,6 @@ static void ogl_render()
|
|||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
else // 8 bpp only works with a shader (opengl 2.0 or above)
|
||||
{
|
||||
g_ogl.use_opengl = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD timeout = g_config.minfps > 0 ? g_ddraw.minfps_tick_len : INFINITE;
|
||||
|
||||
|
@ -1161,11 +1089,8 @@ static void ogl_render()
|
|||
0.0f, g_ogl.scale_h,
|
||||
};
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(tex_coord), tex_coord, GL_STATIC_DRAW);
|
||||
if (g_ogl.shader2_tex_coord_attr_loc != -1)
|
||||
{
|
||||
glVertexAttribPointer(g_ogl.shader2_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader2_tex_coord_attr_loc);
|
||||
}
|
||||
glVertexAttribPointer(g_ogl.shader2_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader2_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
@ -1180,11 +1105,8 @@ static void ogl_render()
|
|||
g_ogl.scale_w, 0.0f,
|
||||
};
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(tex_coord), tex_coord, GL_STATIC_DRAW);
|
||||
if (g_ogl.shader1_tex_coord_attr_loc != -1)
|
||||
{
|
||||
glVertexAttribPointer(g_ogl.shader1_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader1_tex_coord_attr_loc);
|
||||
}
|
||||
glVertexAttribPointer(g_ogl.shader1_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader1_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
@ -1199,11 +1121,8 @@ static void ogl_render()
|
|||
0.0f, g_ogl.scale_h,
|
||||
};
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(tex_coord), tex_coord, GL_STATIC_DRAW);
|
||||
if (g_ogl.shader1_tex_coord_attr_loc != -1)
|
||||
{
|
||||
glVertexAttribPointer(g_ogl.shader1_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader1_tex_coord_attr_loc);
|
||||
}
|
||||
glVertexAttribPointer(g_ogl.shader1_tex_coord_attr_loc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(g_ogl.shader1_tex_coord_attr_loc);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
@ -1225,9 +1144,7 @@ static void ogl_render()
|
|||
}
|
||||
}
|
||||
|
||||
if (glActiveTexture)
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, g_ogl.surface_tex_ids[tex_index]);
|
||||
|
||||
if (g_ddraw.bpp == 8)
|
||||
|
|
181
src/utils.c
181
src/utils.c
|
@ -1,8 +1,6 @@
|
|||
#include <windows.h>
|
||||
#include <intrin.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <tlhelp32.h>
|
||||
#include "ddraw.h"
|
||||
#include "debug.h"
|
||||
#include "dd.h"
|
||||
|
@ -12,8 +10,6 @@
|
|||
#include "render_d3d9.h"
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
#include "versionhelpers.h"
|
||||
#include "delay_imports.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -73,123 +69,6 @@ HMODULE WINAPI util_enumerate_modules(_In_opt_ HMODULE hModuleLast)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void util_set_process_affinity()
|
||||
{
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
|
||||
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||
if (snap == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
||||
THREADENTRY32 entry = { 0 };
|
||||
entry.dwSize = sizeof(THREADENTRY32);
|
||||
|
||||
if (!Thread32First(snap, &entry))
|
||||
{
|
||||
CloseHandle(snap);
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (entry.th32OwnerProcessID == GetCurrentProcessId())
|
||||
{
|
||||
util_set_thread_affinity(entry.th32ThreadID);
|
||||
}
|
||||
} while (Thread32Next(snap, &entry));
|
||||
|
||||
CloseHandle(snap);
|
||||
#endif
|
||||
}
|
||||
|
||||
void util_set_thread_affinity(DWORD tid)
|
||||
{
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
|
||||
HANDLE thread = OpenThread(THREAD_QUERY_INFORMATION | THREAD_SET_INFORMATION, FALSE, tid);
|
||||
if (thread)
|
||||
{
|
||||
void* start = NULL;
|
||||
NTSTATUS status = STATUS_PENDING;
|
||||
|
||||
if (delay_NtQueryInformationThread)
|
||||
{
|
||||
status =
|
||||
delay_NtQueryInformationThread(thread, ThreadQuerySetWin32StartAddress, &start, sizeof(start), NULL);
|
||||
}
|
||||
|
||||
if (status == STATUS_SUCCESS && start && delay_GetModuleHandleExA)
|
||||
{
|
||||
char game_exe_path[MAX_PATH] = { 0 };
|
||||
char game_dir[MAX_PATH] = { 0 };
|
||||
|
||||
if (GetModuleFileNameA(NULL, game_exe_path, sizeof(game_exe_path)))
|
||||
{
|
||||
_splitpath(game_exe_path, NULL, game_dir, NULL, NULL);
|
||||
|
||||
char mod_path[MAX_PATH] = { 0 };
|
||||
char mod_dir[MAX_PATH] = { 0 };
|
||||
char mod_filename[MAX_PATH] = { 0 };
|
||||
HMODULE mod = NULL;
|
||||
|
||||
if (delay_GetModuleHandleExA(
|
||||
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, start, &mod))
|
||||
{
|
||||
if (GetModuleFileNameA(mod, mod_path, sizeof(mod_path)))
|
||||
{
|
||||
_splitpath(mod_path, NULL, mod_dir, mod_filename, NULL);
|
||||
|
||||
if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0) // _strcmpi(mod_filename, "WINMM") == 0
|
||||
{
|
||||
SetThreadAffinityMask(thread, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThreadAffinityMask(thread, 1);
|
||||
}
|
||||
|
||||
CloseHandle(thread);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void util_pull_messages()
|
||||
{
|
||||
if (g_config.fix_not_responding &&
|
||||
g_ddraw.hwnd &&
|
||||
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
|
||||
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
|
||||
!IsWine())
|
||||
{
|
||||
/* workaround for "Not Responding" window problem */
|
||||
//g_ddraw.last_msg_pull_tick = timeGetTime();
|
||||
MSG msg;
|
||||
if (real_PeekMessageA(&msg, g_ddraw.hwnd, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageA(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DWORD util_get_timestamp(HMODULE mod)
|
||||
{
|
||||
if (!mod || mod == INVALID_HANDLE_VALUE)
|
||||
return 0;
|
||||
|
||||
PIMAGE_DOS_HEADER dos_header = (PIMAGE_DOS_HEADER)mod;
|
||||
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
|
||||
return 0;
|
||||
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)dos_header + (DWORD)dos_header->e_lfanew);
|
||||
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
|
||||
return 0;
|
||||
|
||||
return nt_headers->FileHeader.TimeDateStamp;
|
||||
}
|
||||
|
||||
FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
||||
{
|
||||
if (!mod || mod == INVALID_HANDLE_VALUE)
|
||||
|
@ -201,15 +80,17 @@ FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
|||
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
|
||||
return NULL;
|
||||
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)mod + (DWORD)dos_header->e_lfanew);
|
||||
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)dos_header + (DWORD)dos_header->e_lfanew);
|
||||
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
|
||||
return NULL;
|
||||
|
||||
DWORD import_desc_rva = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||
if (!import_desc_rva)
|
||||
DWORD import_desc_size = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size;
|
||||
|
||||
if (import_desc_rva == 0 || import_desc_size == 0)
|
||||
return NULL;
|
||||
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)mod + import_desc_rva);
|
||||
PIMAGE_IMPORT_DESCRIPTOR import_desc = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)dos_header + import_desc_rva);
|
||||
|
||||
while (import_desc->FirstThunk)
|
||||
{
|
||||
|
@ -219,12 +100,12 @@ FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
|||
continue;
|
||||
}
|
||||
|
||||
char* imp_module_name = (char*)((DWORD)mod + import_desc->Name);
|
||||
char* imp_module_name = (char*)((DWORD)dos_header + import_desc->Name);
|
||||
|
||||
if (_stricmp(imp_module_name, module_name) == 0)
|
||||
{
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)mod + import_desc->FirstThunk);
|
||||
PIMAGE_THUNK_DATA o_first_thunk = (void*)((DWORD)mod + import_desc->OriginalFirstThunk);
|
||||
PIMAGE_THUNK_DATA first_thunk = (void*)((DWORD)dos_header + import_desc->FirstThunk);
|
||||
PIMAGE_THUNK_DATA o_first_thunk = (void*)((DWORD)dos_header + import_desc->OriginalFirstThunk);
|
||||
|
||||
while (first_thunk->u1.Function)
|
||||
{
|
||||
|
@ -235,7 +116,7 @@ FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
|||
continue;
|
||||
}
|
||||
|
||||
PIMAGE_IMPORT_BY_NAME import = (void*)((DWORD)mod + o_first_thunk->u1.AddressOfData);
|
||||
PIMAGE_IMPORT_BY_NAME import = (void*)((DWORD)dos_header + o_first_thunk->u1.AddressOfData);
|
||||
|
||||
if ((o_first_thunk->u1.Ordinal & IMAGE_ORDINAL_FLAG) == 0)
|
||||
{
|
||||
|
@ -267,7 +148,10 @@ FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
|||
|
||||
BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
||||
{
|
||||
if (!delay_GetModuleHandleExA)
|
||||
BOOL (WINAPI *getModuleHandleExA)(DWORD, LPCSTR, HMODULE*) =
|
||||
(void*)real_GetProcAddress(real_LoadLibraryA("Kernel32.dll"), "GetModuleHandleExA");
|
||||
|
||||
if (!getModuleHandleExA)
|
||||
return FALSE;
|
||||
|
||||
void* directDrawCreate = (void*)util_get_iat_proc(GetModuleHandleA(NULL), "ddraw.dll", "DirectDrawCreate");
|
||||
|
@ -281,9 +165,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||
HMODULE D3dHook_dll = GetModuleHandleA("D3dHook.dll");
|
||||
if (D3dHook_dll)
|
||||
{
|
||||
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == D3dHook_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == D3dHook_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == D3dHook_dll))
|
||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == D3dHook_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == D3dHook_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == D3dHook_dll))
|
||||
{
|
||||
MessageBoxA(
|
||||
NULL,
|
||||
|
@ -299,9 +183,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||
HMODULE wndmode_dll = GetModuleHandleA("wndmode.dll");
|
||||
if (wndmode_dll)
|
||||
{
|
||||
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == wndmode_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == wndmode_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == wndmode_dll))
|
||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == wndmode_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == wndmode_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == wndmode_dll))
|
||||
{
|
||||
MessageBoxA(
|
||||
NULL,
|
||||
|
@ -317,9 +201,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||
HMODULE windmode_dll = GetModuleHandleA("windmode.dll");
|
||||
if (windmode_dll)
|
||||
{
|
||||
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == windmode_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == windmode_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == windmode_dll))
|
||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == windmode_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == windmode_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == windmode_dll))
|
||||
{
|
||||
MessageBoxA(
|
||||
NULL,
|
||||
|
@ -335,9 +219,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||
HMODULE dxwnd_dll = GetModuleHandleA("dxwnd.dll");
|
||||
if (dxwnd_dll)
|
||||
{
|
||||
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == dxwnd_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == dxwnd_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == dxwnd_dll))
|
||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == dxwnd_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == dxwnd_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == dxwnd_dll))
|
||||
{
|
||||
MessageBoxA(
|
||||
NULL,
|
||||
|
@ -353,9 +237,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||
HMODULE age_dll = GetModuleHandleA("age.dll");
|
||||
if (age_dll)
|
||||
{
|
||||
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == age_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == age_dll) ||
|
||||
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == age_dll))
|
||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == age_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == age_dll) ||
|
||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == age_dll))
|
||||
{
|
||||
HKEY hkey;
|
||||
LONG status =
|
||||
|
@ -692,10 +576,6 @@ void util_toggle_maximize()
|
|||
if (!g_config.resizable || !g_config.windowed || g_config.fullscreen || !g_ddraw.width)
|
||||
return;
|
||||
|
||||
/* Do not allow cnc-ddraw maximize while macOS maximize is active */
|
||||
if (IsMacOS() && !g_config.window_rect.left && !g_config.window_rect.top)
|
||||
return;
|
||||
|
||||
RECT client_rc;
|
||||
RECT dst_rc;
|
||||
|
||||
|
@ -800,10 +680,6 @@ void util_toggle_fullscreen()
|
|||
if (g_ddraw.bnet_active || !g_ddraw.width || (g_config.infantryhack && GetMenu(g_ddraw.hwnd)))
|
||||
return;
|
||||
|
||||
/* Do not allow ALT+ENTER while macOS maximize is active */
|
||||
if (IsMacOS() && !g_config.window_rect.left && !g_config.window_rect.top)
|
||||
return;
|
||||
|
||||
if (g_config.toggle_borderless && g_config.windowed)
|
||||
{
|
||||
if (!g_config.fullscreen)
|
||||
|
@ -989,7 +865,6 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
|
|||
|
||||
if (g_config.fixchilds == FIX_CHILDS_DETECT_HIDE ||
|
||||
g_config.fixchilds == FIX_CHILDS_DETECT_HIDE_NOSCALE ||
|
||||
strcmp(class_name, "Cc2EditClassTh") == 0 ||
|
||||
strcmp(class_name, "msctls_statusbar32") == 0 ||
|
||||
strcmp(class_name, "VideoRenderer") == 0 ||
|
||||
strcmp(class_name, "MCIQTZ_Window") == 0 ||
|
||||
|
|
|
@ -1,30 +1,43 @@
|
|||
#include <windows.h>
|
||||
#include "versionhelpers.h"
|
||||
#include "delay_imports.h"
|
||||
|
||||
typedef NTSTATUS(WINAPI* RTLVERIFYVERSIONINFOPROC)(PRTL_OSVERSIONINFOEXW, ULONG, ULONGLONG);
|
||||
typedef const char* (CDECL* WINE_GET_VERSIONPROC)();
|
||||
typedef void (CDECL* WINE_GET_HOST_VERSIONPROC)(const char** sysname, const char** release);
|
||||
|
||||
static RTLVERIFYVERSIONINFOPROC RtlVerifyVersionInfo;
|
||||
static WINE_GET_VERSIONPROC wine_get_version;
|
||||
static WINE_GET_HOST_VERSIONPROC wine_get_host_version;
|
||||
|
||||
/* GetProcAddress is rather slow so we use a function to initialize it once on startup */
|
||||
void verhelp_init()
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA("ntdll.dll");
|
||||
if (mod)
|
||||
{
|
||||
RtlVerifyVersionInfo = (RTLVERIFYVERSIONINFOPROC)GetProcAddress(mod, "RtlVerifyVersionInfo");
|
||||
wine_get_version = (WINE_GET_VERSIONPROC)GetProcAddress(mod, "wine_get_version");
|
||||
wine_get_host_version = (WINE_GET_HOST_VERSIONPROC)GetProcAddress(mod, "wine_get_host_version");
|
||||
}
|
||||
}
|
||||
|
||||
BOOL verhelp_verify_version(PRTL_OSVERSIONINFOEXW versionInfo, ULONG typeMask, ULONGLONG conditionMask)
|
||||
{
|
||||
return delay_RtlVerifyVersionInfo ?
|
||||
delay_RtlVerifyVersionInfo(versionInfo, typeMask, conditionMask) == 0 :
|
||||
return RtlVerifyVersionInfo ?
|
||||
RtlVerifyVersionInfo(versionInfo, typeMask, conditionMask) == 0 :
|
||||
VerifyVersionInfoW(versionInfo, typeMask, conditionMask);
|
||||
}
|
||||
|
||||
ULONGLONG verhelp_set_mask(ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition)
|
||||
{
|
||||
return delay_VerSetConditionMask ? delay_VerSetConditionMask(ConditionMask, TypeMask, Condition) : 0;
|
||||
}
|
||||
|
||||
const char* verhelp_wine_get_version()
|
||||
{
|
||||
return delay_wine_get_version ? delay_wine_get_version() : NULL;
|
||||
return wine_get_version ? wine_get_version() : NULL;
|
||||
}
|
||||
|
||||
void verhelp_wine_get_host_version(const char** sysname, const char** release)
|
||||
{
|
||||
if (delay_wine_get_host_version)
|
||||
if (wine_get_host_version)
|
||||
{
|
||||
delay_wine_get_host_version(sysname, release);
|
||||
wine_get_host_version(sysname, release);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <math.h>
|
||||
#include <vfw.h>
|
||||
#include "debug.h"
|
||||
#include "config.h"
|
||||
#include "dd.h"
|
||||
|
@ -21,8 +20,6 @@
|
|||
#include "dllmain.h"
|
||||
#include "hook.h"
|
||||
#include "directinput.h"
|
||||
#include "ddpalette.h"
|
||||
#include "palette.h"
|
||||
|
||||
|
||||
BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
|
||||
|
@ -417,20 +414,6 @@ LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
|
|||
if (!g_ddraw.ref || !g_ddraw.hwnd)
|
||||
return real_SendMessageA(hWnd, Msg, wParam, lParam);
|
||||
|
||||
if (g_ddraw.hwnd == hWnd && Msg == WM_MOUSEMOVE)
|
||||
{
|
||||
int x = GET_X_LPARAM(lParam);
|
||||
int y = GET_Y_LPARAM(lParam);
|
||||
|
||||
if (g_config.adjmouse)
|
||||
{
|
||||
x = (int)(roundf(x * g_ddraw.mouse.scale_x));
|
||||
y = (int)(roundf(y * g_ddraw.mouse.scale_y));
|
||||
}
|
||||
|
||||
lParam = MAKELPARAM(x + g_ddraw.mouse.x_adjust, y + g_ddraw.mouse.y_adjust);
|
||||
}
|
||||
|
||||
if (g_ddraw.hwnd == hWnd && Msg == WM_SIZE && g_config.hook != 2)
|
||||
{
|
||||
Msg = WM_SIZE_DDRAW;
|
||||
|
@ -450,7 +433,7 @@ LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
LONG WINAPI fake_SetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && g_ddraw.hwnd == hWnd)
|
||||
if (g_ddraw.ref && g_ddraw.hwnd == hWnd)
|
||||
{
|
||||
if (nIndex == GWL_STYLE)
|
||||
return 0;
|
||||
|
@ -467,17 +450,6 @@ LONG WINAPI fake_SetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong)
|
|||
return real_SetWindowLongA(hWnd, nIndex, dwNewLong);
|
||||
}
|
||||
|
||||
LONG WINAPI fake_SetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && g_ddraw.hwnd == hWnd)
|
||||
{
|
||||
if (nIndex == GWL_STYLE)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return real_SetWindowLongW(hWnd, nIndex, dwNewLong);
|
||||
}
|
||||
|
||||
LONG WINAPI fake_GetWindowLongA(HWND hWnd, int nIndex)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.hwnd == hWnd)
|
||||
|
@ -605,14 +577,12 @@ HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, D
|
|||
dwThreadId,
|
||||
_ReturnAddress());
|
||||
|
||||
dbg_dump_hook_type(idHook);
|
||||
|
||||
if (idHook == WH_KEYBOARD_LL && hmod && GetModuleHandle("AcGenral") == hmod)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (idHook == WH_MOUSE && lpfn && !hmod && !g_mouse_hook && g_config.sirtech_hack)
|
||||
if (idHook == WH_MOUSE && lpfn && !hmod && !g_mouse_hook && g_config.fixmousehook)
|
||||
{
|
||||
g_mouse_proc = lpfn;
|
||||
return g_mouse_hook = real_SetWindowsHookExA(idHook, mouse_hook_proc, hmod, dwThreadId);
|
||||
|
@ -652,7 +622,7 @@ void HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMa
|
|||
lpMsg->pt.y = InterlockedExchangeAdd((LONG*)&g_ddraw.cursor.y, 0);
|
||||
}
|
||||
|
||||
if (lpMsg->hwnd != g_ddraw.hwnd || !g_config.hook_peekmessage)
|
||||
if (lpMsg->hwnd != g_ddraw.hwnd)
|
||||
return;
|
||||
|
||||
switch (LOWORD(lpMsg->message))
|
||||
|
@ -663,37 +633,22 @@ void HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMa
|
|||
{
|
||||
if (!g_config.devmode && !g_mouse_locked && (wRemoveMsg & PM_REMOVE))
|
||||
{
|
||||
int x = GET_X_LPARAM(lpMsg->lParam);
|
||||
int y = GET_Y_LPARAM(lpMsg->lParam);
|
||||
|
||||
if (x > g_ddraw.render.viewport.x + g_ddraw.render.viewport.width ||
|
||||
x < g_ddraw.render.viewport.x ||
|
||||
y > g_ddraw.render.viewport.y + g_ddraw.render.viewport.height ||
|
||||
y < g_ddraw.render.viewport.y)
|
||||
{
|
||||
x = g_ddraw.width / 2;
|
||||
y = g_ddraw.height / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (DWORD)((x - g_ddraw.render.viewport.x) * g_ddraw.mouse.unscale_x);
|
||||
y = (DWORD)((y - g_ddraw.render.viewport.y) * g_ddraw.mouse.unscale_y);
|
||||
}
|
||||
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, x);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, y);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, GET_X_LPARAM(lpMsg->lParam));
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, GET_Y_LPARAM(lpMsg->lParam));
|
||||
|
||||
mouse_lock();
|
||||
|
||||
if (!wMsgFilterMin &&
|
||||
!wMsgFilterMax &&
|
||||
if (!wMsgFilterMin &&
|
||||
!wMsgFilterMax &&
|
||||
!(wRemoveMsg & (PM_QS_INPUT | PM_QS_PAINT | PM_QS_POSTMESSAGE | PM_QS_SENDMESSAGE)))
|
||||
{
|
||||
lpMsg->message = WM_NULL;
|
||||
break;
|
||||
lpMsg->message = (UINT)MAKELONG(WM_NULL, HIWORD(lpMsg->message));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
/* fall through for lParam */
|
||||
|
||||
break;
|
||||
}
|
||||
/* down messages are ignored if we have no cursor lock */
|
||||
case WM_XBUTTONDBLCLK:
|
||||
|
@ -711,53 +666,19 @@ void HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMa
|
|||
{
|
||||
if (!g_config.devmode && !g_mouse_locked)
|
||||
{
|
||||
if (!wMsgFilterMin &&
|
||||
!wMsgFilterMax &&
|
||||
// Does not work with 'New Robinson'
|
||||
if (!wMsgFilterMin &&
|
||||
!wMsgFilterMax &&
|
||||
!(wRemoveMsg & (PM_QS_INPUT | PM_QS_PAINT | PM_QS_POSTMESSAGE | PM_QS_SENDMESSAGE)))
|
||||
{
|
||||
lpMsg->message = WM_NULL;
|
||||
break;
|
||||
lpMsg->message = (UINT)MAKELONG(WM_NULL, HIWORD(lpMsg->message));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (LOWORD(lpMsg->message) == WM_MOUSEWHEEL)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lpMsg->lParam), GET_Y_LPARAM(lpMsg->lParam) };
|
||||
real_ScreenToClient(g_ddraw.hwnd, &pt);
|
||||
lpMsg->lParam = MAKELPARAM(pt.x, pt.y);
|
||||
}
|
||||
|
||||
int x = max(GET_X_LPARAM(lpMsg->lParam) - g_ddraw.mouse.x_adjust, 0);
|
||||
int y = max(GET_Y_LPARAM(lpMsg->lParam) - g_ddraw.mouse.y_adjust, 0);
|
||||
|
||||
if (g_config.adjmouse)
|
||||
{
|
||||
if (g_config.vhack && !g_config.devmode)
|
||||
{
|
||||
POINT pt = { 0, 0 };
|
||||
fake_GetCursorPos(&pt);
|
||||
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (DWORD)(roundf(x * g_ddraw.mouse.unscale_x));
|
||||
y = (DWORD)(roundf(y * g_ddraw.mouse.unscale_y));
|
||||
}
|
||||
}
|
||||
|
||||
x = min(x, g_ddraw.width - 1);
|
||||
y = min(y, g_ddraw.height - 1);
|
||||
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, x);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, y);
|
||||
|
||||
lpMsg->lParam = MAKELPARAM(x, y);
|
||||
|
||||
lpMsg->pt.x = x;
|
||||
lpMsg->pt.y = y;
|
||||
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, GET_X_LPARAM(lpMsg->lParam));
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, GET_Y_LPARAM(lpMsg->lParam));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -780,21 +701,6 @@ BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wM
|
|||
|
||||
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
|
||||
{
|
||||
if (g_config.darkcolony_hack && !hWnd)
|
||||
{
|
||||
hWnd = g_ddraw.hwnd;
|
||||
|
||||
MSG msg;
|
||||
real_PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
|
||||
}
|
||||
|
||||
if (g_config.limiter_type == LIMIT_PEEKMESSAGE &&
|
||||
g_ddraw.ticks_limiter.tick_length > 0 &&
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, FALSE))
|
||||
{
|
||||
util_limit_game_ticks();
|
||||
}
|
||||
|
||||
if (g_ddraw.ref && (!hWnd || hWnd == g_ddraw.hwnd))
|
||||
g_ddraw.last_msg_pull_tick = timeGetTime();
|
||||
|
||||
|
@ -825,7 +731,7 @@ BOOL WINAPI fake_GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT* lpwndpl)
|
|||
lpwndpl->rcNormalPosition.right = g_ddraw.width;
|
||||
lpwndpl->rcNormalPosition.top = 0;
|
||||
}
|
||||
else if (!IsChild(g_ddraw.hwnd, hWnd) && !(real_GetWindowLongA(hWnd, GWL_STYLE) & WS_CHILD))
|
||||
else
|
||||
{
|
||||
real_MapWindowPoints(HWND_DESKTOP, g_ddraw.hwnd, (LPPOINT)&lpwndpl->rcNormalPosition, 2);
|
||||
}
|
||||
|
@ -834,17 +740,6 @@ BOOL WINAPI fake_GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT* lpwndpl)
|
|||
return result;
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_SetWindowPlacement(HWND hWnd, const WINDOWPLACEMENT* lpwndpl)
|
||||
{
|
||||
if (lpwndpl && g_ddraw.ref && g_ddraw.hwnd && hWnd == g_ddraw.hwnd)
|
||||
{
|
||||
if (lpwndpl->showCmd == SW_SHOWMAXIMIZED || lpwndpl->showCmd == SW_MAXIMIZE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return real_SetWindowPlacement(hWnd, lpwndpl);
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, DEVMODEA* lpDevMode)
|
||||
{
|
||||
BOOL result = real_EnumDisplaySettingsA(lpszDeviceName, iModeNum, lpDevMode);
|
||||
|
@ -883,66 +778,6 @@ BOOL WINAPI fake_EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, DEV
|
|||
return result;
|
||||
}
|
||||
|
||||
LRESULT WINAPI fake_DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && g_ddraw.hwnd == hWnd)
|
||||
{
|
||||
if (Msg == WM_NCHITTEST)
|
||||
return HTCLIENT;
|
||||
}
|
||||
|
||||
return real_DefWindowProcA(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
HWND WINAPI fake_SetParent(HWND hWndChild, HWND hWndNewParent)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && g_ddraw.hwnd == hWndNewParent)
|
||||
{
|
||||
char class_name[MAX_PATH] = { 0 };
|
||||
GetClassNameA(hWndChild, class_name, sizeof(class_name) - 1);
|
||||
|
||||
if (strcmp(class_name, "VideoRenderer") == 0)
|
||||
{
|
||||
RECT rc_org;
|
||||
fake_GetWindowRect(hWndChild, &rc_org);
|
||||
|
||||
HWND result = real_SetParent(hWndChild, hWndNewParent);
|
||||
|
||||
real_MoveWindow(
|
||||
hWndChild,
|
||||
rc_org.left,
|
||||
rc_org.top,
|
||||
(rc_org.right - rc_org.left),
|
||||
(rc_org.bottom - rc_org.top),
|
||||
FALSE);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return real_SetParent(hWndChild, hWndNewParent);
|
||||
}
|
||||
|
||||
HDC WINAPI fake_BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.width && g_ddraw.hwnd && g_ddraw.hwnd == hWnd && lpPaint)
|
||||
{
|
||||
HDC result = real_BeginPaint(hWnd, lpPaint);
|
||||
|
||||
if (result)
|
||||
{
|
||||
lpPaint->rcPaint.left = 0;
|
||||
lpPaint->rcPaint.top = 0;
|
||||
lpPaint->rcPaint.right = g_ddraw.width;
|
||||
lpPaint->rcPaint.bottom = g_ddraw.height;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return real_BeginPaint(hWnd, lpPaint);
|
||||
}
|
||||
|
||||
SHORT WINAPI fake_GetKeyState(int nVirtKey)
|
||||
{
|
||||
if (g_config.windowed && g_ddraw.ref && g_ddraw.hwnd && !util_in_foreground())
|
||||
|
@ -966,80 +801,36 @@ SHORT WINAPI fake_GetAsyncKeyState(int vKey)
|
|||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index)
|
||||
{
|
||||
DWORD bpp = 0;
|
||||
DWORD width = 0;
|
||||
DWORD height = 0;
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.bpp)
|
||||
{
|
||||
bpp = g_ddraw.bpp;
|
||||
width = g_ddraw.width;
|
||||
height = g_ddraw.height;
|
||||
}
|
||||
else if (g_config.fake_mode[0])
|
||||
{
|
||||
char* e = &g_config.fake_mode[0];
|
||||
|
||||
width = strtoul(e, &e, 0);
|
||||
height = strtoul(e + 1, &e, 0);
|
||||
strtoul(e, &e, 0);
|
||||
strtoul(e + 1, &e, 0);
|
||||
bpp = strtoul(e + 1, &e, 0);
|
||||
}
|
||||
|
||||
if (bpp && index == BITSPIXEL)
|
||||
if (bpp && index == BITSPIXEL && (g_config.hook != 2 || g_ddraw.renderer == gdi_render_main))
|
||||
{
|
||||
return bpp;
|
||||
}
|
||||
|
||||
if (bpp == 8)
|
||||
if (bpp == 8 && (g_config.hook != 2 || g_ddraw.renderer == gdi_render_main))
|
||||
{
|
||||
if (index == RASTERCAPS)
|
||||
{
|
||||
return RC_PALETTE | real_GetDeviceCaps(hdc, index);
|
||||
}
|
||||
|
||||
if (index == SIZEPALETTE)
|
||||
if (index == SIZEPALETTE || index == NUMCOLORS)
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
if (index == NUMCOLORS)
|
||||
{
|
||||
if (WindowFromDC(hdc) == GetDesktopWindow())
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (width && ((g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) || WindowFromDC(hdc) == GetDesktopWindow()))
|
||||
{
|
||||
if (index == HORZRES)
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
if (index == VERTRES)
|
||||
{
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
return real_GetDeviceCaps(hdc, index);
|
||||
}
|
||||
|
||||
int WINAPI fake_GetDeviceCaps_system(HDC hdc, int index)
|
||||
{
|
||||
if (g_ddraw.ref &&
|
||||
g_ddraw.bpp == 8 &&
|
||||
((g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) || WindowFromDC(hdc) == GetDesktopWindow()))
|
||||
{
|
||||
if (index == RASTERCAPS)
|
||||
{
|
||||
return RC_PALETTE | real_GetDeviceCaps(hdc, index);
|
||||
}
|
||||
}
|
||||
|
||||
return real_GetDeviceCaps(hdc, index);
|
||||
|
@ -1060,11 +851,6 @@ BOOL WINAPI fake_StretchBlt(
|
|||
{
|
||||
HWND hwnd = WindowFromDC(hdcDest);
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd == g_ddraw.hwnd && !g_ddraw.primary)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
}
|
||||
|
||||
char class_name[MAX_PATH] = { 0 };
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd && hwnd != g_ddraw.hwnd)
|
||||
|
@ -1118,39 +904,12 @@ BOOL WINAPI fake_StretchBlt(
|
|||
return result;
|
||||
}
|
||||
}
|
||||
else if (
|
||||
g_ddraw.width > 0 &&
|
||||
g_ddraw.render.hdc &&
|
||||
(hwnd == g_ddraw.hwnd ||
|
||||
(real_GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT) ||
|
||||
strcmp(class_name, "AVIWnd32") == 0))
|
||||
else if (g_ddraw.width > 0 && g_ddraw.render.hdc)
|
||||
{
|
||||
POINT pt = { 0 };
|
||||
real_MapWindowPoints(hwnd, g_ddraw.hwnd, &pt, 1);
|
||||
|
||||
if (hwnd != g_ddraw.hwnd && strcmp(class_name, "AVIWnd32") == 0)
|
||||
{
|
||||
LONG exstyle = real_GetWindowLongA(hwnd, GWL_EXSTYLE);
|
||||
if (!(exstyle & WS_EX_TRANSPARENT))
|
||||
{
|
||||
real_SetWindowLongA(hwnd, GWL_EXSTYLE, exstyle | WS_EX_TRANSPARENT);
|
||||
|
||||
real_SetWindowPos(
|
||||
hwnd,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SWP_ASYNCWINDOWPOS | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return real_StretchBlt(
|
||||
hwnd == g_ddraw.hwnd ? hdcDest : g_ddraw.render.hdc,
|
||||
(int)(roundf((xDest + pt.x) * g_ddraw.render.scale_w)) + g_ddraw.render.viewport.x,
|
||||
(int)(roundf((yDest + pt.y) * g_ddraw.render.scale_h)) + g_ddraw.render.viewport.y,
|
||||
(int)(roundf(xDest * g_ddraw.render.scale_w)) + g_ddraw.render.viewport.x,
|
||||
(int)(roundf(yDest * g_ddraw.render.scale_h)) + g_ddraw.render.viewport.y,
|
||||
(int)(roundf(wDest * g_ddraw.render.scale_w)),
|
||||
(int)(roundf(hDest * g_ddraw.render.scale_h)),
|
||||
hdcSrc,
|
||||
|
@ -1197,11 +956,6 @@ BOOL WINAPI fake_BitBlt(
|
|||
{
|
||||
HWND hwnd = WindowFromDC(hdc);
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd == g_ddraw.hwnd && !g_ddraw.primary)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
}
|
||||
|
||||
char class_name[MAX_PATH] = { 0 };
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd && hwnd != g_ddraw.hwnd)
|
||||
|
@ -1246,10 +1000,7 @@ BOOL WINAPI fake_BitBlt(
|
|||
return result;
|
||||
}
|
||||
}
|
||||
else if (
|
||||
g_ddraw.width > 0 &&
|
||||
g_ddraw.render.hdc &&
|
||||
(hwnd == g_ddraw.hwnd || (real_GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
|
||||
else if (g_ddraw.width > 0 && g_ddraw.render.hdc)
|
||||
{
|
||||
return real_StretchBlt(
|
||||
hwnd == g_ddraw.hwnd ? hdc : g_ddraw.render.hdc,
|
||||
|
@ -1298,11 +1049,6 @@ int WINAPI fake_SetDIBitsToDevice(
|
|||
{
|
||||
HWND hwnd = WindowFromDC(hdc);
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd == g_ddraw.hwnd && !g_ddraw.primary)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
}
|
||||
|
||||
char class_name[MAX_PATH] = { 0 };
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd && hwnd != g_ddraw.hwnd)
|
||||
|
@ -1350,10 +1096,7 @@ int WINAPI fake_SetDIBitsToDevice(
|
|||
return result;
|
||||
}
|
||||
}
|
||||
else if (
|
||||
g_ddraw.width > 0 &&
|
||||
g_ddraw.render.hdc &&
|
||||
(hwnd == g_ddraw.hwnd || (real_GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
|
||||
else if (g_ddraw.width > 0 && g_ddraw.render.hdc)
|
||||
{
|
||||
return
|
||||
real_StretchDIBits(
|
||||
|
@ -1393,11 +1136,6 @@ int WINAPI fake_StretchDIBits(
|
|||
{
|
||||
HWND hwnd = WindowFromDC(hdc);
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd == g_ddraw.hwnd && !g_ddraw.primary)
|
||||
{
|
||||
InterlockedExchange(&g_ddraw.render.screen_updated, TRUE);
|
||||
}
|
||||
|
||||
char class_name[MAX_PATH] = { 0 };
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && hwnd && hwnd != g_ddraw.hwnd)
|
||||
|
@ -1446,10 +1184,7 @@ int WINAPI fake_StretchDIBits(
|
|||
return result;
|
||||
}
|
||||
}
|
||||
else if (
|
||||
g_ddraw.width > 0 &&
|
||||
g_ddraw.render.hdc &&
|
||||
(hwnd == g_ddraw.hwnd || (real_GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
|
||||
else if (g_ddraw.width > 0 && g_ddraw.render.hdc)
|
||||
{
|
||||
return
|
||||
real_StretchDIBits(
|
||||
|
@ -1548,97 +1283,6 @@ HFONT WINAPI fake_CreateFontA(
|
|||
lpszFace);
|
||||
}
|
||||
|
||||
UINT WINAPI fake_GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries)
|
||||
{
|
||||
TRACE(
|
||||
"%s(hdc=%p, iStart=%u, cEntries=%u, pPalEntries=%p) [%p]\n",
|
||||
__FUNCTION__,
|
||||
hdc,
|
||||
iStart,
|
||||
cEntries,
|
||||
pPalEntries,
|
||||
_ReturnAddress());
|
||||
|
||||
if (g_ddraw.ref && g_ddraw.bpp == 8 && pPalEntries && GetObjectType(hdc) == OBJ_DC)
|
||||
{
|
||||
TRACE(" Display DC\n");
|
||||
|
||||
if (g_ddraw.primary && g_ddraw.primary->palette)
|
||||
{
|
||||
ddp_GetEntries(g_ddraw.primary->palette, 0, iStart, cEntries, pPalEntries);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = iStart, x = 0; i < iStart + cEntries && i < 256; i++, x++)
|
||||
{
|
||||
pPalEntries[x] = g_ddp_default_palette[i];
|
||||
}
|
||||
}
|
||||
|
||||
return cEntries;
|
||||
}
|
||||
|
||||
return real_GetSystemPaletteEntries(hdc, iStart, cEntries, pPalEntries);
|
||||
}
|
||||
|
||||
HPALETTE WINAPI fake_SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd)
|
||||
{
|
||||
TRACE_EXT(
|
||||
"%s(hdc=%p, hPal=%p, bForceBkgd=%d) [%p]\n",
|
||||
__FUNCTION__,
|
||||
hdc,
|
||||
hPal,
|
||||
bForceBkgd,
|
||||
_ReturnAddress());
|
||||
|
||||
if (g_ddraw.ref &&
|
||||
g_ddraw.bpp == 8 &&
|
||||
((g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) || WindowFromDC(hdc) == GetDesktopWindow()))
|
||||
{
|
||||
TRACE_EXT(" Display DC\n");
|
||||
|
||||
if (g_ddraw.primary && g_ddraw.primary->palette)
|
||||
{
|
||||
g_ddraw.primary->selected_pal_count = GetPaletteEntries(hPal, 0, 256, g_ddraw.primary->selected_pal);
|
||||
|
||||
return real_SelectPalette(g_ddraw.primary->hdc, hPal, bForceBkgd);;
|
||||
}
|
||||
}
|
||||
|
||||
return real_SelectPalette(hdc, hPal, bForceBkgd);
|
||||
}
|
||||
|
||||
UINT WINAPI fake_RealizePalette(HDC hdc)
|
||||
{
|
||||
TRACE_EXT("%s(hdc=%p) [%p]\n", __FUNCTION__, hdc, _ReturnAddress());
|
||||
|
||||
if (g_ddraw.ref &&
|
||||
g_ddraw.bpp == 8 &&
|
||||
((g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) || WindowFromDC(hdc) == GetDesktopWindow()))
|
||||
{
|
||||
TRACE_EXT(" Display DC\n");
|
||||
|
||||
if (g_ddraw.primary && g_ddraw.primary->palette)
|
||||
{
|
||||
if (g_ddraw.primary->selected_pal_count != 256)
|
||||
{
|
||||
TRACE_EXT(" selected_pal_count = %u\n", g_ddraw.primary->selected_pal_count);
|
||||
}
|
||||
|
||||
ddp_SetEntries(
|
||||
g_ddraw.primary->palette,
|
||||
DDPCAPS_REFRESH_CHANGED_ONLY,
|
||||
0,
|
||||
g_ddraw.primary->selected_pal_count,
|
||||
g_ddraw.primary->selected_pal);
|
||||
|
||||
return g_ddraw.primary->selected_pal_count;
|
||||
}
|
||||
}
|
||||
|
||||
return real_RealizePalette(hdc);
|
||||
}
|
||||
|
||||
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName)
|
||||
{
|
||||
HMODULE hmod_old = GetModuleHandleA(lpLibFileName);
|
||||
|
@ -2054,14 +1698,6 @@ HWND WINAPI fake_CreateWindowExA(
|
|||
dwStyle &= ~WS_POPUP;
|
||||
}
|
||||
|
||||
/* Dark Colony */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "Merc Direct Draw Driver") == 0 &&
|
||||
lpWindowName && _strcmpi(lpWindowName, "Direct Draw Driver") == 0 &&
|
||||
!dwExStyle)
|
||||
{
|
||||
dwExStyle |= WS_EX_APPWINDOW;
|
||||
}
|
||||
|
||||
/* Fallout 1/2 */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "GNW95 Class") == 0 &&
|
||||
lpWindowName && strstr(lpWindowName, "FALLOUT"))
|
||||
|
@ -2070,13 +1706,6 @@ HWND WINAPI fake_CreateWindowExA(
|
|||
dwExStyle |= WS_EX_APPWINDOW;
|
||||
}
|
||||
|
||||
/* Fallout Tactics */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "bosWin32Class") == 0 &&
|
||||
lpWindowName && _strcmpi(lpWindowName, "Fallout: Tactics (TM)") == 0)
|
||||
{
|
||||
dwStyle |= WS_VISIBLE;
|
||||
}
|
||||
|
||||
/* Center Claw DVD movies */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "Afx:400000:3") == 0 &&
|
||||
g_ddraw.ref && g_ddraw.hwnd && hWndParent == g_ddraw.hwnd &&
|
||||
|
@ -2098,28 +1727,6 @@ HWND WINAPI fake_CreateWindowExA(
|
|||
Y = pt.y + align_y;
|
||||
}
|
||||
|
||||
/* Metal Knight Movies */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "Afx:400000:3:0:1900011:0") == 0 &&
|
||||
lpWindowName && _strcmpi(lpWindowName, "AVI player") == 0 &&
|
||||
dwStyle == WS_POPUP &&
|
||||
dwExStyle == WS_EX_TOPMOST &&
|
||||
g_ddraw.ref && g_ddraw.hwnd &&
|
||||
g_ddraw.width)
|
||||
{
|
||||
dwExStyle = 0;
|
||||
|
||||
POINT pt = { 0, 0 };
|
||||
real_ClientToScreen(g_ddraw.hwnd, &pt);
|
||||
|
||||
int added_height = g_ddraw.render.height - g_ddraw.height;
|
||||
int added_width = g_ddraw.render.width - g_ddraw.width;
|
||||
int align_y = added_height > 0 ? added_height / 2 : 0;
|
||||
int align_x = added_width > 0 ? added_width / 2 : 0;
|
||||
|
||||
X += pt.x + align_x;
|
||||
Y += pt.y + align_y;
|
||||
}
|
||||
|
||||
/* Disney Trivia Challenge */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "Disney Trivia Challenge") == 0 &&
|
||||
hWndParent && (dwStyle & WS_CHILD))
|
||||
|
@ -2156,13 +1763,6 @@ HWND WINAPI fake_CreateWindowExA(
|
|||
hWndParent = g_ddraw.hwnd;
|
||||
}
|
||||
|
||||
/* A Bug's Life Action Game */
|
||||
//HIWORD(lpClassName) && _strcmpi(lpClassName, "Bugs") == 0 &&
|
||||
if (dwExStyle == 0x01000008)
|
||||
{
|
||||
dwExStyle = WS_EX_TOPMOST;
|
||||
}
|
||||
|
||||
/* Fix for SMACKW32.DLL creating another window that steals the focus */
|
||||
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "MouseTypeWind") == 0 && g_ddraw.ref && g_ddraw.hwnd)
|
||||
{
|
||||
|
@ -2343,27 +1943,3 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI fake_SetUnhandledExceptionFilter(
|
|||
return old;
|
||||
//return real_SetUnhandledExceptionFilter(lpTopLevelExceptionFilter);
|
||||
}
|
||||
|
||||
PGETFRAME WINAPI fake_AVIStreamGetFrameOpen(PAVISTREAM pavi, LPBITMAPINFOHEADER lpbiWanted)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.primary && (DWORD)lpbiWanted == AVIGETFRAMEF_BESTDISPLAYFMT)
|
||||
{
|
||||
DDBITMAPINFO bmi;
|
||||
memcpy(&bmi, g_ddraw.primary->bmi, sizeof(DDBITMAPINFO));
|
||||
|
||||
bmi.bmiHeader.biHeight = 0;
|
||||
bmi.bmiHeader.biWidth = 0;
|
||||
|
||||
if (g_ddraw.bpp == 8 && g_ddraw.primary->palette)
|
||||
{
|
||||
memcpy(&bmi.bmiColors[0], g_ddraw.primary->palette->data_rgb, sizeof(bmi.bmiColors));
|
||||
}
|
||||
|
||||
PGETFRAME result = real_AVIStreamGetFrameOpen(pavi, (LPBITMAPINFOHEADER)&bmi);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
|
||||
return real_AVIStreamGetFrameOpen(pavi, lpbiWanted);
|
||||
}
|
||||
|
|
198
src/wndproc.c
198
src/wndproc.c
|
@ -49,9 +49,8 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case WM_NCPAINT:
|
||||
case WM_CANCELMODE:
|
||||
case WM_DISPLAYCHANGE:
|
||||
case WM_NCCALCSIZE:
|
||||
{
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
|
@ -89,48 +88,20 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
return 0;
|
||||
}
|
||||
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
case WM_KILLFOCUS:
|
||||
case WM_NCACTIVATE:
|
||||
{
|
||||
if (g_config.noactivateapp)
|
||||
{
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_NCHITTEST:
|
||||
{
|
||||
if (g_mouse_locked || g_config.devmode)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
if (!g_config.windowed || real_ScreenToClient(g_ddraw.hwnd, &pt))
|
||||
{
|
||||
int x = max(pt.x - g_ddraw.mouse.x_adjust, 0);
|
||||
int y = max(pt.y - g_ddraw.mouse.y_adjust, 0);
|
||||
|
||||
if (g_config.adjmouse)
|
||||
{
|
||||
x = (DWORD)(roundf(x * g_ddraw.mouse.unscale_x));
|
||||
y = (DWORD)(roundf(y * g_ddraw.mouse.unscale_y));
|
||||
}
|
||||
|
||||
pt.x = min(x, g_ddraw.width - 1);
|
||||
pt.y = min(y, g_ddraw.height - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pt.x = InterlockedExchangeAdd((LONG*)&g_ddraw.cursor.x, 0);
|
||||
pt.y = InterlockedExchangeAdd((LONG*)&g_ddraw.cursor.y, 0);
|
||||
}
|
||||
|
||||
CallWindowProcA(g_ddraw.wndproc, hWnd, uMsg, wParam, MAKELPARAM(pt.x, pt.y));
|
||||
}
|
||||
|
||||
LRESULT result = real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
LRESULT result = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (!g_config.resizable)
|
||||
{
|
||||
|
@ -175,7 +146,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case HTTOP:
|
||||
case HTTOPLEFT:
|
||||
case HTTOPRIGHT:
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
case HTCLIENT:
|
||||
if (!g_mouse_locked && !g_config.devmode)
|
||||
{
|
||||
|
@ -245,12 +216,6 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
|
||||
return 0;
|
||||
}
|
||||
case IDT_TIMER_LINUX_FIX_WINDOW_SIZE:
|
||||
{
|
||||
KillTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE);
|
||||
util_set_window_rect(0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -476,70 +441,20 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
{
|
||||
if (g_config.windowed)
|
||||
{
|
||||
WORD width = LOWORD(lParam);
|
||||
WORD height = HIWORD(lParam);
|
||||
|
||||
if (wParam == SIZE_RESTORED)
|
||||
{
|
||||
/* macOS maximize hack */
|
||||
if (in_size_move && g_ddraw.render.thread && IsMacOS())
|
||||
{
|
||||
EnterCriticalSection(&g_ddraw.cs);
|
||||
g_ddraw.render.run = FALSE;
|
||||
ReleaseSemaphore(g_ddraw.render.sem, 1, NULL);
|
||||
LeaveCriticalSection(&g_ddraw.cs);
|
||||
|
||||
WaitForSingleObject(g_ddraw.render.thread, INFINITE);
|
||||
g_ddraw.render.thread = NULL;
|
||||
}
|
||||
|
||||
if (in_size_move && !g_ddraw.render.thread)
|
||||
{
|
||||
g_config.window_rect.right = width;
|
||||
g_config.window_rect.bottom = height;
|
||||
g_config.window_rect.right = LOWORD(lParam);
|
||||
g_config.window_rect.bottom = HIWORD(lParam);
|
||||
}
|
||||
else if (!in_size_move && g_ddraw.render.thread && !g_config.fullscreen && IsLinux())
|
||||
else if (!in_size_move && g_ddraw.render.thread && !g_config.fullscreen && g_config.wine_allow_resize && IsLinux())
|
||||
{
|
||||
if (width != g_ddraw.render.width || height != g_ddraw.render.height)
|
||||
{
|
||||
KillTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE);
|
||||
|
||||
g_config.window_rect.right = width;
|
||||
g_config.window_rect.bottom = height;
|
||||
g_config.window_rect.right = LOWORD(lParam);
|
||||
g_config.window_rect.bottom = HIWORD(lParam);
|
||||
|
||||
if (g_config.window_rect.right != g_ddraw.render.width || g_config.window_rect.bottom != g_ddraw.render.height)
|
||||
dd_SetDisplayMode(0, 0, 0, 0);
|
||||
|
||||
if (width < g_ddraw.width || height < g_ddraw.height)
|
||||
{
|
||||
/* Can't enforce minimum window size in linux because there is no WM_SIZING and
|
||||
WM_GETMINMAXINFO is ignored for whatever reasons */
|
||||
|
||||
SetTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE, 1000, (TIMERPROC)NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (wParam == SIZE_MAXIMIZED)
|
||||
{
|
||||
if (!in_size_move && g_ddraw.render.thread && !g_config.fullscreen && IsLinux())
|
||||
{
|
||||
if (width != g_ddraw.render.width || height != g_ddraw.render.height)
|
||||
{
|
||||
KillTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE);
|
||||
|
||||
g_config.window_rect.right = width;
|
||||
g_config.window_rect.bottom = height;
|
||||
|
||||
dd_SetDisplayMode(0, 0, 0, 0);
|
||||
|
||||
if (width < g_ddraw.width || height < g_ddraw.height)
|
||||
{
|
||||
/* Can't enforce minimum window size in linux because there is no WM_SIZING and
|
||||
WM_GETMINMAXINFO is ignored for whatever reasons */
|
||||
|
||||
SetTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE, 1000, (TIMERPROC)NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -550,7 +465,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
}
|
||||
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
}
|
||||
case WM_MOVE:
|
||||
{
|
||||
|
@ -564,7 +479,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
util_update_bnet_pos(x, y);
|
||||
}
|
||||
|
||||
if (in_size_move || (IsLinux() && !g_config.fullscreen && g_ddraw.render.thread))
|
||||
if (in_size_move || (IsWine() && !g_config.fullscreen && g_ddraw.render.thread))
|
||||
{
|
||||
if (x != -32000)
|
||||
g_config.window_rect.left = x; /* -32000 = Exit/Minimize */
|
||||
|
@ -577,7 +492,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
if (g_ddraw.got_child_windows)
|
||||
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
}
|
||||
case WM_RESTORE_STYLE:
|
||||
{
|
||||
|
@ -607,9 +522,6 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
|
||||
if (wParam == SC_MAXIMIZE)
|
||||
{
|
||||
if (IsWine())
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (g_config.resizable)
|
||||
{
|
||||
util_toggle_maximize();
|
||||
|
@ -620,18 +532,14 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
|
||||
if (wParam == SC_CLOSE && !GameHandlesClose)
|
||||
{
|
||||
if (g_config.terminate_process)
|
||||
g_config.terminate_process = 2;
|
||||
|
||||
ExitProcess(0);
|
||||
//_exit(0);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
if (wParam == SC_KEYMENU && GetMenu(g_ddraw.hwnd) == NULL)
|
||||
return 0;
|
||||
|
||||
if (!GameHandlesClose)
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -767,7 +675,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
}
|
||||
}
|
||||
|
||||
if (wParam && g_config.fix_alt_key_stuck)
|
||||
if (wParam && g_config.releasealt)
|
||||
{
|
||||
INPUT ip;
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
|
@ -799,7 +707,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
break;
|
||||
}
|
||||
|
||||
if (wParam && g_ddraw.alt_key_down && !g_config.fix_alt_key_stuck)
|
||||
if (wParam && g_ddraw.alt_key_down && !g_config.releasealt)
|
||||
{
|
||||
PostMessageA(g_ddraw.hwnd, WM_SYSKEYUP, VK_MENU, 0);
|
||||
g_ddraw.alt_key_down = FALSE;
|
||||
|
@ -854,18 +762,13 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
}
|
||||
case WM_SYSKEYDOWN:
|
||||
{
|
||||
if (wParam == VK_F4)
|
||||
{
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_SYSKEYUP:
|
||||
{
|
||||
if (wParam == VK_TAB || (wParam && wParam == g_config.hotkeys.toggle_fullscreen))
|
||||
{
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -885,33 +788,14 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
{
|
||||
if (!g_config.devmode && !g_mouse_locked)
|
||||
{
|
||||
int x = GET_X_LPARAM(lParam);
|
||||
int y = GET_Y_LPARAM(lParam);
|
||||
|
||||
if (x > g_ddraw.render.viewport.x + g_ddraw.render.viewport.width ||
|
||||
x < g_ddraw.render.viewport.x ||
|
||||
y > g_ddraw.render.viewport.y + g_ddraw.render.viewport.height ||
|
||||
y < g_ddraw.render.viewport.y)
|
||||
{
|
||||
x = g_ddraw.width / 2;
|
||||
y = g_ddraw.height / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (DWORD)((x - g_ddraw.render.viewport.x) * g_ddraw.mouse.unscale_x);
|
||||
y = (DWORD)((y - g_ddraw.render.viewport.y) * g_ddraw.mouse.unscale_y);
|
||||
}
|
||||
|
||||
x = min(x, g_ddraw.width - 1);
|
||||
y = min(y, g_ddraw.height - 1);
|
||||
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, x);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, y);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, GET_X_LPARAM(lParam));
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, GET_Y_LPARAM(lParam));
|
||||
|
||||
mouse_lock();
|
||||
return 0;
|
||||
}
|
||||
/* fall through for lParam */
|
||||
|
||||
break;
|
||||
}
|
||||
/* down messages are ignored if we have no cursor lock */
|
||||
case WM_XBUTTONDBLCLK:
|
||||
|
@ -932,40 +816,8 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (uMsg == WM_MOUSEWHEEL)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
real_ScreenToClient(g_ddraw.hwnd, &pt);
|
||||
lParam = MAKELPARAM(pt.x, pt.y);
|
||||
}
|
||||
|
||||
int x = max(GET_X_LPARAM(lParam) - g_ddraw.mouse.x_adjust, 0);
|
||||
int y = max(GET_Y_LPARAM(lParam) - g_ddraw.mouse.y_adjust, 0);
|
||||
|
||||
if (g_config.adjmouse)
|
||||
{
|
||||
if (g_config.vhack && !g_config.devmode)
|
||||
{
|
||||
POINT pt = { 0, 0 };
|
||||
fake_GetCursorPos(&pt);
|
||||
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (DWORD)(roundf(x * g_ddraw.mouse.unscale_x));
|
||||
y = (DWORD)(roundf(y * g_ddraw.mouse.unscale_y));
|
||||
}
|
||||
}
|
||||
|
||||
x = min(x, g_ddraw.width - 1);
|
||||
y = min(y, g_ddraw.height - 1);
|
||||
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, x);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, y);
|
||||
|
||||
lParam = MAKELPARAM(x, y);
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.x, GET_X_LPARAM(lParam));
|
||||
InterlockedExchange((LONG*)&g_ddraw.cursor.y, GET_Y_LPARAM(lParam));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue