Skip to content

Commit

Permalink
support new OPL proxy with dynamic address
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Dec 29, 2018
1 parent 0b4c3a3 commit 691bdc5
Show file tree
Hide file tree
Showing 27 changed files with 505 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ set(SOURCES
"src/formats_sup.cpp"
"src/importer.cpp"
"src/latency.cpp"
"src/hardware.cpp"
"src/ins_names.cpp"
"src/main.cpp"
"src/opl/generator.cpp"
Expand Down
2 changes: 2 additions & 0 deletions FMBankEdit.pro
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ SOURCES += \
src/formats_sup.cpp \
src/importer.cpp \
src/latency.cpp \
src/hardware.cpp \
src/ins_names.cpp \
src/main.cpp \
src/opl/generator.cpp \
Expand Down Expand Up @@ -162,6 +163,7 @@ HEADERS += \
src/formats_sup.h \
src/importer.h \
src/latency.h \
src/hardware.h \
src/ins_names.h \
src/main.h \
src/opl/generator.h \
Expand Down
4 changes: 3 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ IF NOT -%1-==-win9x- (
SET DEST_ARCHIVE=opl3-bank-editor-dev-win32.zip
SET DEPLOY_FILES=.\bin-release\*
IF -%1-==-win9x- (
SET DEPLOY_FILES=%DEPLOY_FILES% .\opl_proxy\liboplproxy.dll
SET DEPLOY_FILES=%DEPLOY_FILES% .\opl_proxy\win9x\liboplproxy.dll
SET DEST_ARCHIVE=opl3-bank-editor-dev-win9x.zip
) ELSE (
SET DEPLOY_FILES=%DEPLOY_FILES% .\opl_proxy\modern\liboplproxy.dll
)
SET DEPLOY_FILES=%DEPLOY_FILES% Bank_Examples
SET DEPLOY_FILES=%DEPLOY_FILES% .\formats_info.htm .\license.txt .\changelog.txt
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions opl_proxy/modern/oplproxy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* OPL3 chip interface proxy for OPL Bank Editor by Wohlstand,
* a part of free tool for music bank editing
*
* Copyright (c) 2016-2018 Vitaly Novichkov <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
Can be built by mingw-w64
*/

#include "InpOut32Helper.h"

#define DLLExport __declspec(dllexport)
#define STDCall __stdcall
typedef unsigned short uint16_t;

static uint16_t OPLBase = 0x388;

DLLExport void STDCall chipInit(void)
{ OpenInpOut32(); }

DLLExport void STDCall chipSetPort(uint16_t port)
{ OPLBase = port; }

DLLExport void STDCall chipUnInit(void)
{ CloseInpOut32(); }

DLLExport void STDCall chipPoke(uint16_t index, uint16_t value)
{
uint16_t c, o = (index >> 8), port = (OPLBase + o * 2);
outportb(port, index);
for(c = 0; c < 6; ++c) inportb(port);
outportb(port + 1, value);
for(c = 0; c < 35; ++c) inportb(port);
}

Binary file added opl_proxy/modern/oplproxy.dll
Binary file not shown.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions opl_proxy/win9x/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.lib
!liboplproxy.dll
*.map
*.lk1
*.mk1
*.sym
*.mk
*.obj
6 changes: 6 additions & 0 deletions opl_proxy/win9x/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OPL Proxy - a small backend tool created for OPL Bank Editor by Wohlstand
to provide ability to test instruments on real OPL3 chip by running under Windows 98.

On Windows NT family operating system this trick will not work.

Build this tool by OpenWatcom
Binary file added opl_proxy/win9x/liboplproxy.dll
Binary file not shown.
150 changes: 150 additions & 0 deletions opl_proxy/win9x/liboplproxy.tgt
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
40
targetIdent
0
MProject
1
MComponent
0
2
WString
4
NDLL
3
WString
5
n_2d9
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
15
liboplproxy.dll
7
WString
4
NDLL
8
WVList
4
9
MRState
10
WString
5
WLINK
11
WString
25
?????No debug information
1
1
12
MRState
13
WString
5
WLINK
14
WString
14
?????Debug all
1
0
15
MCState
16
WString
5
WLINK
17
WString
13
?????Map file
1
0
18
MCState
19
WString
5
WLINK
20
WString
24
?????Eliminate dead code
1
1
21
WVList
1
22
ActionStates
23
WString
5
&Make
24
WVList
0
-1
1
1
0
25
WPickList
2
26
MItem
3
*.c
27
WString
4
COBJ
28
WVList
0
29
WVList
0
-1
1
1
0
30
MItem
10
oplproxy.c
31
WString
4
COBJ
32
WVList
1
33
MCState
34
WString
3
WCC
35
WString
26
?????Force ANSI compliance
1
1
36
WVList
0
26
1
1
0
30 changes: 30 additions & 0 deletions opl_proxy/win9x/liboplproxy_exports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file liboplproxy.dll

File Type: DLL

Section contains the following exports for liboplproxy.dll

00000000 characteristics
0 time date stamp
0.00 version
1 ordinal base
3 number of functions
3 number of names

ordinal hint RVA name

1 0 00001010 _chipInit@0
3 1 0000104A _chipPoke@8
2 2 0000102D _chipUnInit@0

Summary

1000 .edata
1000 .idata
1000 .reloc
6000 AUTO
3000 DGROUP
File renamed without changes.
43 changes: 43 additions & 0 deletions opl_proxy/win9x/oplproxy.wpj
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
40
projectIdent
0
VpeMain
1
WRect
232
110
7872
8400
2
MProject
3
MCommand
0
4
MCommand
0
1
5
WFileName
15
liboplproxy.tgt
6
WVList
1
7
VComponent
8
WRect
416
410
5712
4360
0
0
9
WFileName
15
liboplproxy.tgt
0
1
7
1 change: 1 addition & 0 deletions opl_proxy/win9x/update_exports.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\dumpbin.exe" /exports liboplproxy.dll > liboplproxy_exports.txt
34 changes: 34 additions & 0 deletions src/bank_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@
#include "bank_editor.h"
#include "ui_bank_editor.h"
#include "latency.h"
#include "hardware.h"
#include "ins_names.h"
#include "main.h"
#if defined(ENABLE_PLOTS)
#include "delay_analysis.h"
#endif
#ifdef ENABLE_WIN9X_OPL_PROXY // to set hardware port
#include "opl/chips/win9x_opl_proxy.h"
#endif

#include "FileFormats/ffmt_factory.h"
#include "FileFormats/ffmt_enums.h"
Expand Down Expand Up @@ -113,6 +117,10 @@ BankEditor::BankEditor(QWidget *parent) :
ui->actionWin9xOPLProxy->setVisible(false);
#endif

#ifndef ENABLE_WIN9X_OPL_PROXY
ui->actionHardware_OPL->setVisible(false);
#endif

ui->instruments->installEventFilter(this);

ui->pitchBendSlider->setTracking(true);
Expand Down Expand Up @@ -1209,6 +1217,32 @@ void BankEditor::on_actionLatency_triggered()
delete dlg;
}

#ifdef ENABLE_WIN9X_OPL_PROXY
void BankEditor::on_actionHardware_OPL_triggered()
{
Win9x_OPL_Proxy proxy;
bool supportsChangeAddress = proxy.canSetOplAddress();

HardwareDialog *dlg = new HardwareDialog;

dlg->setOplAddress(m_proxyOplAddress);
dlg->setCanChangeOplAddress(supportsChangeAddress);
dlg->exec();

if(supportsChangeAddress)
{
unsigned newAddress = dlg->oplAddress();
if(newAddress != m_proxyOplAddress)
{
proxy.setOplAddress(newAddress);
m_proxyOplAddress = newAddress;
}
}

delete dlg;
}
#endif

void BankEditor::onActionLanguageTriggered()
{
QAction *act = static_cast<QAction *>(sender());
Expand Down
Loading

0 comments on commit 691bdc5

Please sign in to comment.