prompt
large_stringlengths
70
991k
completion
large_stringlengths
0
1.02k
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/** * Reparse the Grunt command line options flags. * * Using the arguments parsing logic from Grunt: * https://github.com/gruntjs/grunt/blob/master/lib/grunt/cli.js */ module.exports = function(grunt){ // Get the current Grunt CLI instance. var nopt = require('nopt'), parsedOptions = parseOptions(nopt, grunt.cli.optlist); grunt.log.debug('(nopt-grunt-fix) old flags: ', grunt.option.flags()); // Reassign the options. resetOptions(grunt, parsedOptions); grunt.log.debug('(nopt-grunt-fix) new flags: ', grunt.option.flags()); return grunt; }; // Normalise the parameters and then parse them. function parseOptions(nopt, optlist){ var params = getParams(optlist); var parsedOptions = nopt(params.known, params.aliases, process.argv, 2); initArrays(optlist, parsedOptions); return parsedOptions; } // Reassign the options on the Grunt instance. function resetOptions(grunt, parsedOptions){<|fim▁hole|> if (parsedOptions.hasOwnProperty(i) && i != 'argv'){ grunt.option(i, parsedOptions[i]); } } } // Parse `optlist` into a form that nopt can handle. function getParams(optlist){ var aliases = {}; var known = {}; Object.keys(optlist).forEach(function(key) { var short = optlist[key].short; if (short) { aliases[short] = '--' + key; } known[key] = optlist[key].type; }); return { known: known, aliases: aliases } } // Initialize any Array options that weren't initialized. function initArrays(optlist, parsedOptions){ Object.keys(optlist).forEach(function(key) { if (optlist[key].type === Array && !(key in parsedOptions)) { parsedOptions[key] = []; } }); }<|fim▁end|>
for (var i in parsedOptions){
<|file_name|>ProcessorManagementNamingStrategy.java<|end_file_name|><|fim▁begin|>/* * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openehealth.ipf.platform.camel.core.management; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.apache.camel.CamelContext; import org.apache.camel.Processor; import org.apache.camel.management.DefaultManagementNamingStrategy; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ProcessorDefinitionHelper; import org.apache.camel.model.RouteDefinition; /** * @author Reinhard Luft */ public class ProcessorManagementNamingStrategy extends DefaultManagementNamingStrategy { public static final String KEY_ROUTE = "route"; public ObjectName getObjectNameForProcessor(CamelContext context, Processor processor, ProcessorDefinition<?> definition) throws MalformedObjectNameException { StringBuilder buffer = new StringBuilder();<|fim▁hole|> RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); if (route != null) { buffer.append(KEY_ROUTE + "=").append(route.getId()).append(","); } buffer.append(KEY_NAME + "=").append(ObjectName.quote(definition.getId())); return createObjectName(buffer); } }<|fim▁end|>
buffer.append(domainName).append(":"); buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(","); buffer.append(KEY_TYPE + "=").append(TYPE_PROCESSOR).append(",");
<|file_name|>SamplePlayer.cpp<|end_file_name|><|fim▁begin|>/* * tracker/SamplePlayer.cpp * * Copyright 2009 Peter Barth * * This file is part of Milkytracker. * * Milkytracker 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 * (at your option) any later version. * * Milkytracker 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 Milkytracker. If not, see <http://www.gnu.org/licenses/>. * */ /* * SamplePlayer.cpp * MilkyTracker * * Created by Peter Barth on 13.12.07. * */ #include "SamplePlayer.h" #include "ModuleEditor.h" #include "SampleEditor.h" #include "PlayerController.h" void SamplePlayer::playSample(const TXMSample& smp, pp_uint32 note, pp_int32 rangeStart/* = -1*/, pp_int32 rangeEnd/* = -1*/) { playerController.playSample(smp, note, rangeStart, rangeEnd); } void SamplePlayer::playSample(pp_int32 insIndex, pp_int32 smpIndex, pp_uint32 note) { playSample(*moduleEditor.getSampleInfo(insIndex, smpIndex), note);<|fim▁hole|> void SamplePlayer::playSample(pp_int32 insIndex, pp_uint32 note) { const mp_ubyte* nbu = moduleEditor.getSampleTable(insIndex); pp_int32 smpIndex = nbu[note]; playSample(insIndex, smpIndex, note); } void SamplePlayer::playCurrentSample(pp_uint32 note) { playSample(*moduleEditor.getSampleEditor()->getSample(), note); } void SamplePlayer::playCurrentSampleFromOffset(pp_uint32 offset, pp_uint32 note) { SampleEditor* sampleEditor = moduleEditor.getSampleEditor(); if (offset != -1) { playSample(*sampleEditor->getSample(), note, offset, sampleEditor->getSampleLen()); } } void SamplePlayer::playCurrentSampleSelectionRange(pp_uint32 note) { SampleEditor* sampleEditor = moduleEditor.getSampleEditor(); if (sampleEditor->getLogicalSelectionStart() != -1 && sampleEditor->getLogicalSelectionEnd() != -1) { playSample(*sampleEditor->getSample(), note, sampleEditor->getLogicalSelectionStart(), sampleEditor->getLogicalSelectionEnd()); } } void SamplePlayer::stopSamplePlayback() { playerController.stopSample(); }<|fim▁end|>
}
<|file_name|>logs.go<|end_file_name|><|fim▁begin|>package types import "github.com/traefik/paerser/types" const ( // AccessLogKeep is the keep string value. AccessLogKeep = "keep" // AccessLogDrop is the drop string value. AccessLogDrop = "drop" // AccessLogRedact is the redact string value. AccessLogRedact = "redact" ) const ( // CommonFormat is the common logging format (CLF). CommonFormat string = "common" // JSONFormat is the JSON logging format. JSONFormat string = "json" ) // TraefikLog holds the configuration settings for the traefik logger. type TraefikLog struct { Level string `description:"Log level set to traefik logs." json:"level,omitempty" toml:"level,omitempty" yaml:"level,omitempty" export:"true"` FilePath string `description:"Traefik log file path. Stdout is used when omitted or empty." json:"filePath,omitempty" toml:"filePath,omitempty" yaml:"filePath,omitempty"`<|fim▁hole|> Format string `description:"Traefik log format: json | common" json:"format,omitempty" toml:"format,omitempty" yaml:"format,omitempty" export:"true"` } // SetDefaults sets the default values. func (l *TraefikLog) SetDefaults() { l.Format = CommonFormat l.Level = "ERROR" } // AccessLog holds the configuration settings for the access logger (middlewares/accesslog). type AccessLog struct { FilePath string `description:"Access log file path. Stdout is used when omitted or empty." json:"filePath,omitempty" toml:"filePath,omitempty" yaml:"filePath,omitempty"` Format string `description:"Access log format: json | common" json:"format,omitempty" toml:"format,omitempty" yaml:"format,omitempty" export:"true"` Filters *AccessLogFilters `description:"Access log filters, used to keep only specific access logs." json:"filters,omitempty" toml:"filters,omitempty" yaml:"filters,omitempty" export:"true"` Fields *AccessLogFields `description:"AccessLogFields." json:"fields,omitempty" toml:"fields,omitempty" yaml:"fields,omitempty" export:"true"` BufferingSize int64 `description:"Number of access log lines to process in a buffered way." json:"bufferingSize,omitempty" toml:"bufferingSize,omitempty" yaml:"bufferingSize,omitempty" export:"true"` } // SetDefaults sets the default values. func (l *AccessLog) SetDefaults() { l.Format = CommonFormat l.FilePath = "" l.Filters = &AccessLogFilters{} l.Fields = &AccessLogFields{} l.Fields.SetDefaults() } // AccessLogFilters holds filters configuration. type AccessLogFilters struct { StatusCodes []string `description:"Keep access logs with status codes in the specified range." json:"statusCodes,omitempty" toml:"statusCodes,omitempty" yaml:"statusCodes,omitempty" export:"true"` RetryAttempts bool `description:"Keep access logs when at least one retry happened." json:"retryAttempts,omitempty" toml:"retryAttempts,omitempty" yaml:"retryAttempts,omitempty" export:"true"` MinDuration types.Duration `description:"Keep access logs when request took longer than the specified duration." json:"minDuration,omitempty" toml:"minDuration,omitempty" yaml:"minDuration,omitempty" export:"true"` } // FieldHeaders holds configuration for access log headers. type FieldHeaders struct { DefaultMode string `description:"Default mode for fields: keep | drop | redact" json:"defaultMode,omitempty" toml:"defaultMode,omitempty" yaml:"defaultMode,omitempty" export:"true"` Names map[string]string `description:"Override mode for headers" json:"names,omitempty" toml:"names,omitempty" yaml:"names,omitempty" export:"true"` } // AccessLogFields holds configuration for access log fields. type AccessLogFields struct { DefaultMode string `description:"Default mode for fields: keep | drop" json:"defaultMode,omitempty" toml:"defaultMode,omitempty" yaml:"defaultMode,omitempty" export:"true"` Names map[string]string `description:"Override mode for fields" json:"names,omitempty" toml:"names,omitempty" yaml:"names,omitempty" export:"true"` Headers *FieldHeaders `description:"Headers to keep, drop or redact" json:"headers,omitempty" toml:"headers,omitempty" yaml:"headers,omitempty" export:"true"` } // SetDefaults sets the default values. func (f *AccessLogFields) SetDefaults() { f.DefaultMode = AccessLogKeep f.Headers = &FieldHeaders{ DefaultMode: AccessLogDrop, } } // Keep check if the field need to be kept or dropped. func (f *AccessLogFields) Keep(field string) bool { defaultKeep := true if f != nil { defaultKeep = checkFieldValue(f.DefaultMode, defaultKeep) if v, ok := f.Names[field]; ok { return checkFieldValue(v, defaultKeep) } } return defaultKeep } // KeepHeader checks if the headers need to be kept, dropped or redacted and returns the status. func (f *AccessLogFields) KeepHeader(header string) string { defaultValue := AccessLogKeep if f != nil && f.Headers != nil { defaultValue = checkFieldHeaderValue(f.Headers.DefaultMode, defaultValue) if v, ok := f.Headers.Names[header]; ok { return checkFieldHeaderValue(v, defaultValue) } } return defaultValue } func checkFieldValue(value string, defaultKeep bool) bool { switch value { case AccessLogKeep: return true case AccessLogDrop: return false default: return defaultKeep } } func checkFieldHeaderValue(value, defaultValue string) string { if value == AccessLogKeep || value == AccessLogDrop || value == AccessLogRedact { return value } return defaultValue }<|fim▁end|>
<|file_name|>ipc.net.ts<|end_file_name|><|fim▁begin|>/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Socket, Server as NetServer, createConnection, createServer } from 'net'; import { Event, Emitter } from 'vs/base/common/event'; import { ClientConnectionEvent, IPCServer } from 'vs/base/parts/ipc/common/ipc'; import { join } from 'vs/base/common/path'; import { tmpdir } from 'os'; import { generateUuid } from 'vs/base/common/uuid'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { VSBuffer } from 'vs/base/common/buffer'; import { ISocket, Protocol, Client, ChunkStream } from 'vs/base/parts/ipc/common/ipc.net'; export class NodeSocket implements ISocket { public readonly socket: Socket; constructor(socket: Socket) { this.socket = socket; } public dispose(): void { this.socket.destroy(); } public onData(_listener: (e: VSBuffer) => void): IDisposable { const listener = (buff: Buffer) => _listener(VSBuffer.wrap(buff)); this.socket.on('data', listener); return { dispose: () => this.socket.off('data', listener) }; } public onClose(listener: () => void): IDisposable { this.socket.on('close', listener); return { dispose: () => this.socket.off('close', listener) }; } public onEnd(listener: () => void): IDisposable { this.socket.on('end', listener); return { dispose: () => this.socket.off('end', listener) }; } public write(buffer: VSBuffer): void { // return early if socket has been destroyed in the meantime if (this.socket.destroyed) { return; } // we ignore the returned value from `write` because we would have to cached the data // anyways and nodejs is already doing that for us: // > https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback // > However, the false return value is only advisory and the writable stream will unconditionally // > accept and buffer chunk even if it has not been allowed to drain. this.socket.write(<Buffer>buffer.buffer); } public end(): void { this.socket.end(); } } const enum Constants { MinHeaderByteSize = 2 } const enum ReadState { PeekHeader = 1, ReadHeader = 2, ReadBody = 3, Fin = 4 } /** * See https://tools.ietf.org/html/rfc6455#section-5.2 */ export class WebSocketNodeSocket extends Disposable implements ISocket { public readonly socket: NodeSocket; private readonly _incomingData: ChunkStream; private readonly _onData = this._register(new Emitter<VSBuffer>()); private readonly _state = { state: ReadState.PeekHeader, readLen: Constants.MinHeaderByteSize, mask: 0 }; constructor(socket: NodeSocket) { super(); this.socket = socket; this._incomingData = new ChunkStream(); this._register(this.socket.onData(data => this._acceptChunk(data))); } public dispose(): void { this.socket.dispose(); } public onData(listener: (e: VSBuffer) => void): IDisposable { return this._onData.event(listener); } public onClose(listener: () => void): IDisposable { return this.socket.onClose(listener); } public onEnd(listener: () => void): IDisposable { return this.socket.onEnd(listener); } public write(buffer: VSBuffer): void { let headerLen = Constants.MinHeaderByteSize; if (buffer.byteLength < 126) { headerLen += 0; } else if (buffer.byteLength < 2 ** 16) { headerLen += 2; } else { headerLen += 8; } const header = VSBuffer.alloc(headerLen); header.writeUInt8(0b10000010, 0); if (buffer.byteLength < 126) { header.writeUInt8(buffer.byteLength, 1); } else if (buffer.byteLength < 2 ** 16) { header.writeUInt8(126, 1); let offset = 1; header.writeUInt8((buffer.byteLength >>> 8) & 0b11111111, ++offset); header.writeUInt8((buffer.byteLength >>> 0) & 0b11111111, ++offset); } else { header.writeUInt8(127, 1); let offset = 1; header.writeUInt8(0, ++offset); header.writeUInt8(0, ++offset); header.writeUInt8(0, ++offset); header.writeUInt8(0, ++offset); header.writeUInt8((buffer.byteLength >>> 24) & 0b11111111, ++offset); header.writeUInt8((buffer.byteLength >>> 16) & 0b11111111, ++offset); header.writeUInt8((buffer.byteLength >>> 8) & 0b11111111, ++offset); header.writeUInt8((buffer.byteLength >>> 0) & 0b11111111, ++offset); } this.socket.write(VSBuffer.concat([header, buffer])); } public end(): void { this.socket.end(); } private _acceptChunk(data: VSBuffer): void { if (data.byteLength === 0) { return; } this._incomingData.acceptChunk(data); while (this._incomingData.byteLength >= this._state.readLen) { if (this._state.state === ReadState.PeekHeader) { // peek to see if we can read the entire header const peekHeader = this._incomingData.peek(this._state.readLen); // const firstByte = peekHeader.readUInt8(0); // const finBit = (firstByte & 0b10000000) >>> 7; const secondByte = peekHeader.readUInt8(1); const hasMask = (secondByte & 0b10000000) >>> 7; const len = (secondByte & 0b01111111); this._state.state = ReadState.ReadHeader; this._state.readLen = Constants.MinHeaderByteSize + (hasMask ? 4 : 0) + (len === 126 ? 2 : 0) + (len === 127 ? 8 : 0); this._state.mask = 0; } else if (this._state.state === ReadState.ReadHeader) { // read entire header const header = this._incomingData.read(this._state.readLen); const secondByte = header.readUInt8(1); const hasMask = (secondByte & 0b10000000) >>> 7; let len = (secondByte & 0b01111111); let offset = 1; if (len === 126) { len = ( header.readUInt8(++offset) * 2 ** 8 + header.readUInt8(++offset) ); } else if (len === 127) { len = ( header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 2 ** 24 + header.readUInt8(++offset) * 2 ** 16 + header.readUInt8(++offset) * 2 ** 8 + header.readUInt8(++offset) ); } let mask = 0; if (hasMask) { mask = ( header.readUInt8(++offset) * 2 ** 24 + header.readUInt8(++offset) * 2 ** 16 + header.readUInt8(++offset) * 2 ** 8 + header.readUInt8(++offset) ); } this._state.state = ReadState.ReadBody; this._state.readLen = len; this._state.mask = mask; } else if (this._state.state === ReadState.ReadBody) { // read body const body = this._incomingData.read(this._state.readLen); unmask(body, this._state.mask); this._state.state = ReadState.PeekHeader; this._state.readLen = Constants.MinHeaderByteSize; this._state.mask = 0; this._onData.fire(body); } } } } function unmask(buffer: VSBuffer, mask: number): void { if (mask === 0) { return; } let cnt = buffer.byteLength >>> 2; for (let i = 0; i < cnt; i++) { const v = buffer.readUInt32BE(i * 4); buffer.writeUInt32BE(v ^ mask, i * 4); } let offset = cnt * 4; let bytesLeft = buffer.byteLength - offset; const m3 = (mask >>> 24) & 0b11111111; const m2 = (mask >>> 16) & 0b11111111; const m1 = (mask >>> 8) & 0b11111111; if (bytesLeft >= 1) { buffer.writeUInt8(buffer.readUInt8(offset) ^ m3, offset); } if (bytesLeft >= 2) { buffer.writeUInt8(buffer.readUInt8(offset + 1) ^ m2, offset + 1); } if (bytesLeft >= 3) { buffer.writeUInt8(buffer.readUInt8(offset + 2) ^ m1, offset + 2); } } export function generateRandomPipeName(): string { const randomSuffix = generateUuid(); if (process.platform === 'win32') { return `\\\\.\\pipe\\vscode-ipc-${randomSuffix}-sock`; } else { // Mac/Unix: use socket file return join(tmpdir(), `vscode-ipc-${randomSuffix}.sock`); } } export class Server extends IPCServer { private static toClientConnectionEvent(server: NetServer): Event<ClientConnectionEvent> { const onConnection = Event.fromNodeEventEmitter<Socket>(server, 'connection'); return Event.map(onConnection, socket => ({ protocol: new Protocol(new NodeSocket(socket)), onDidClientDisconnect: Event.once(Event.fromNodeEventEmitter<void>(socket, 'close')) })); } private server: NetServer | null; constructor(server: NetServer) { super(Server.toClientConnectionEvent(server)); this.server = server; } dispose(): void { super.dispose(); if (this.server) { this.server.close(); this.server = null; } } } export function serve(port: number): Promise<Server>; export function serve(namedPipe: string): Promise<Server>; export function serve(hook: any): Promise<Server> { return new Promise<Server>((c, e) => { const server = createServer(); server.on('error', e); server.listen(hook, () => { server.removeListener('error', e); c(new Server(server)); }); }); } export function connect(options: { host: string, port: number }, clientId: string): Promise<Client>; export function connect(port: number, clientId: string): Promise<Client>; export function connect(namedPipe: string, clientId: string): Promise<Client>; export function connect(hook: any, clientId: string): Promise<Client> { return new Promise<Client>((c, e) => {<|fim▁hole|> socket.once('error', e); }); }<|fim▁end|>
const socket = createConnection(hook, () => { socket.removeListener('error', e); c(Client.fromSocket(new NodeSocket(socket), clientId)); });
<|file_name|>coerce-reborrow-imm-vec-rcvr.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>// run-pass fn bar(v: &mut [usize]) -> Vec<usize> { v.to_vec() } fn bip(v: &[usize]) -> Vec<usize> { v.to_vec() } pub fn main() { let mut the_vec = vec![1, 2, 3, 100]; assert_eq!(the_vec.clone(), bar(&mut the_vec)); assert_eq!(the_vec.clone(), bip(&the_vec)); }<|fim▁end|>
<|file_name|>livecode.rs<|end_file_name|><|fim▁begin|>use futures::channel::mpsc::{self, UnboundedReceiver, UnboundedSender}; use futures::executor; use futures::future; use futures::prelude::*; use notify::*; use future_ext::{Breaker, FutureWrapExt}; use module::{audio_io::Frame, flow, Module}; use std::path::{Path, PathBuf}; use std::process; use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; fn start_simple_processor<F: FnMut(Frame) -> Frame + Send + 'static, Ex: executor::Executor>( processor: F, in_port: Arc<flow::Port<Frame, ()>>, out_port: Arc<flow::Port<(), Frame>>, breaker: Breaker, mut exec: Ex, ) { exec.spawn(Box::new(future::loop_fn( (processor, in_port, out_port, breaker), |(processor, in_port, out_port, breaker)| { in_port .write1(()) .wrap((processor, out_port, breaker)) .map_err(|((processor, out_port, breaker), (in_port, err))| { ( processor, in_port, out_port, breaker, format!("in write1 {:?}", err), ) }) .and_then(|((processor, out_port, breaker), in_port)| { in_port.read1().wrap((processor, out_port, breaker)).map_err( |((processor, out_port, breaker), (in_port, err))| { ( processor, in_port, out_port, breaker, format!("in read1 {:?}", err), ) }, ) }) .and_then(|((processor, out_port, breaker), (in_port, frame))| { out_port .read1() .wrap((processor, in_port, breaker, frame)) .map_err(|((processor, in_port, breaker, frame), (out_port, err))| { ( processor, in_port, out_port, breaker, format!("out read1 {:?}", err), ) }) }) .and_then(move |((mut processor, in_port, breaker, frame), (out_port, _))| { out_port .write1(processor(frame)) .wrap((processor, in_port, breaker)) .map_err(|((processor, in_port, breaker), (out_port, err))| { ( processor, in_port, out_port, breaker, format!("out write1 {:?}", err), ) }) }) .recover(|(processor, in_port, out_port, breaker, err)| { println!("err: {}", err); ((processor, in_port, breaker), out_port) }) .map(|((processor, in_port, breaker), out_port)| { if breaker.test() { future::Loop::Break(()) } else { future::Loop::Continue((processor, in_port, out_port, breaker)) } }) }, ))).unwrap(); } #[derive(Debug)] enum UserCommand { NewFile(String), } pub struct LiveCode { ifc: Arc<flow::Interface>, in_port: Arc<flow::Port<Frame, ()>>, out_port: Arc<flow::Port<(), Frame>>, breaker: Breaker, cmd_rx: Option<UnboundedReceiver<UserCommand>>, cmd_tx: Option<UnboundedSender<UserCommand>>, watcher: Arc<Mutex<Option<RecommendedWatcher>>>, child: Arc<Mutex<Option<process::Child>>>, } impl Drop for LiveCode { fn drop(&mut self) { self.child.lock().unwrap().take().map(|mut child| { println!("killing leftover child"); child.kill() }); } } impl Module for LiveCode { fn new(ifc: Arc<flow::Interface>) -> LiveCode { let in_port = ifc.get_or_create_port("Input".into()); let out_port = ifc.get_or_create_port("Output".into()); let (cmd_tx, cmd_rx) = mpsc::unbounded(); LiveCode { ifc, in_port, out_port, breaker: Breaker::new(), cmd_rx: Some(cmd_rx), cmd_tx: Some(cmd_tx), watcher: Arc::default(), child: Arc::default(), } } fn start<Ex: executor::Executor>(&mut self, mut exec: Ex) { let cmd_rx = self.cmd_rx.take().unwrap(); let watcher_handle = self.watcher.clone(); let child_handle = self.child.clone(); exec.spawn(Box::new( cmd_rx .for_each(move |event| { println!("event {:?}", event); match event { UserCommand::NewFile(filename) => { let (tx, rx) = ::std::sync::mpsc::channel(); let mut watcher: RecommendedWatcher = Watcher::new(tx, Duration::from_secs(1)).unwrap(); // watch parent dir and filter later, because if we just watch the file and // it gets removed it will stop watching it let parent_dir = Path::new(&filename).parent().unwrap(); watcher.watch(parent_dir, RecursiveMode::NonRecursive).unwrap(); // store it globally because otherwise it gets dropped and stops watching *watcher_handle.lock().unwrap() = Some(watcher); let child_handle = child_handle.clone(); spawn_child(&child_handle, PathBuf::from(&filename)); // TODO // This thread gets leaked, as does the thread spawned internally inside // the watcher... the notify crate is not cleaning up properly. // Not sure if it's mio that's broken or what. thread::spawn(move || loop { match rx.recv() { Ok(event) => { println!("{:?}", event); match event { DebouncedEvent::Write(path) => { if path.to_str().unwrap() != filename { continue; } spawn_child(&child_handle, path); } _ => {} } } Err(e) => { println!("Watcher thread done: {:?}", e); return; } } }); } } Ok(()) }) .then(|x| Ok(())), )).unwrap(); let child_handle = self.child.clone(); start_simple_processor( move |mut frame: Frame| -> Frame { let mut guard = child_handle.lock().unwrap(); let child = match *guard { Some(ref mut child) => child, None => return frame, }; let stdin = child.stdin.as_mut().unwrap(); let stdout = child.stdout.as_mut().unwrap(); //temporary hack //need to use futures for io use std::io::{Read, Write}; use std::mem; let mut buffer: Vec<_> = frame.data.iter().cloned().collect(); let bytes: &mut [u8] = unsafe { ::std::slice::from_raw_parts_mut( buffer.as_ptr() as *mut u8, buffer.len() * mem::size_of::<f32>(), ) }; stdin.write(bytes).unwrap(); stdout.read(bytes).unwrap(); for (outs, ins) in frame.data.iter_mut().zip(buffer.drain(..)) { *outs = ins; } frame }, self.in_port.clone(), self.out_port.clone(), self.breaker.clone(), exec, ); } fn name() -> &'static str { "Livecode" } fn stop(&mut self) { self.breaker.brake(); } fn ports(&self) -> Vec<Arc<flow::OpaquePort>> { self.ifc.ports() } } fn spawn_child(child_handle: &Arc<Mutex<Option<process::Child>>>, path: PathBuf) { let child = match process::Command::new(path) .stdin(process::Stdio::piped()) .stdout(process::Stdio::piped()) .spawn() { Ok(child) => child, Err(e) => { println!("err spawning: {:?}", e); return; } }; let mut child_handle = child_handle.lock().unwrap(); child_handle.take().map(|mut child| { println!("killing previous child"); child.kill().unwrap(); }); *child_handle = Some(child); } use gfx_device_gl as gl; use gui::{button::*, component::*, event::*, geom::*, module_gui::*, render::*}; struct LiveCodeGui { bounds: Box3, open_button: Button, cmd_tx: UnboundedSender<UserCommand>, } const PADDING: f32 = 4.0; impl ModuleGui for LiveCode { fn new_body(&mut self, ctx: &mut RenderContext, bounds: Box3) -> Box<dyn GuiComponent<BodyUpdate>> { Box::new(LiveCodeGui { cmd_tx: self.cmd_tx.take().unwrap(), bounds, open_button: Button::new( ctx.clone(), "Pick file".into(), Box3 { pos: bounds.pos + Pt3::new(PADDING, PADDING, 0.0), size: Pt3::new(bounds.size.x - PADDING * 2.0, 26.0, 0.0), }, ), }) } } impl GuiComponent<bool> for LiveCodeGui { fn set_bounds(&mut self, bounds: Box3) {<|fim▁hole|> fn bounds(&self) -> Box3 { self.bounds } fn render(&mut self, device: &mut gl::Device, ctx: &mut RenderContext) { self.open_button.render(device, ctx); } fn handle(&mut self, event: &Event) -> BodyUpdate { match self.open_button.handle(event) { ButtonUpdate::Unchanged => false, ButtonUpdate::NeedRender => true, ButtonUpdate::Clicked => { match nfd::open_file_dialog(None, None).unwrap() { nfd::Response::Okay(path) => { self.open_button.set_label(path.clone()); self.cmd_tx.unbounded_send(UserCommand::NewFile(path)).unwrap(); } nfd::Response::Cancel => println!("selection cancelled"), _ => panic!(), } true } } } }<|fim▁end|>
self.bounds = bounds; }
<|file_name|>SingularValuesSlider.tsx<|end_file_name|><|fim▁begin|>import * as React from "react"; import * as noUiSlider from "nouislider"; export interface SVSliderProps { value: number; maxSvs: number; max: number; onUpdate: (svs: number) => void; } export class SingularValuesSlider extends React.Component<SVSliderProps> { private sliderElRef: React.RefObject<HTMLDivElement>; constructor(props: SVSliderProps) { super(props); this.sliderElRef = React.createRef(); } render(): JSX.Element { return <div ref={this.sliderElRef} className="slider" />; } private getNoUiSlider(): noUiSlider.noUiSlider | undefined { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const instance = (this.sliderElRef.current! as HTMLElement) as noUiSlider.Instance; return instance.noUiSlider; } componentDidUpdate(prevProps: SVSliderProps): void { const slider = this.getNoUiSlider(); if (!slider) { return; } if (this.props.value !== SingularValuesSlider.getSliderValue(slider)) { // hacky slider.set(this.props.value); } if (this.props.maxSvs !== prevProps.maxSvs) { slider.destroy(); this.buildSlider(); } } componentDidMount(): void { this.buildSlider(); } private static getSliderValue(noUiSlider: noUiSlider.noUiSlider): number { return Math.round(parseInt(noUiSlider.get() as string, 10)); } private buildSlider(): void { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const sliderEl = this.sliderElRef.current! as HTMLElement; noUiSlider.create(sliderEl, this.getSliderOptions()); const slider = (sliderEl as noUiSlider.Instance).noUiSlider; const getSliderValue = (): number => SingularValuesSlider.getSliderValue(slider); slider.on("update", () => { const val = getSliderValue(); if (val !== this.props.value) { if (this.props.onUpdate) { this.props.onUpdate(val); } } }); } private getSliderOptions(): noUiSlider.Options { const maxVal = this.props.max; const maxSvs = this.props.maxSvs; const values: number[] = []; for (let i = 1; i < 20; i++) { values.push(i); } for (let i = 20; i < 100; i += 5) { values.push(i); } for (let i = 100; i < maxVal; i += 10) { values.push(i); } values.push(maxVal); return { // TODO: adapt to image size behaviour: "snap", range: { min: [1, 1], "18%": [10, 2], "30%": [20, 10], "48%": [100, 20], max: [maxVal], }, start: this.props.value, pips: { mode: "values", values: values, density: 10, filter: (v: number): number => { if (v > maxSvs) { return 0; } if (v === 1 || v === 10 || v === 20) { return 1; } if (v % 100 === 0) { return 1; } if (v < 10) { return 2; } if (v < 20 && v % 2 === 0) { return 2; } if (v < 100 && v % 10 === 0) { return 2; } if (v % 20 === 0) { return 2;<|fim▁hole|> } return 0; }, }, }; } }<|fim▁end|>
<|file_name|>defaults_test.go<|end_file_name|><|fim▁begin|>/* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ <|fim▁hole|> "testing" "k8s.io/api/scheduling/v1alpha1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/kubernetes/pkg/api/legacyscheme" apiv1 "k8s.io/api/core/v1" utilfeature "k8s.io/apiserver/pkg/util/feature" featuregatetesting "k8s.io/component-base/featuregate/testing" // enforce that all types are installed _ "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/features" ) func roundTrip(t *testing.T, obj runtime.Object) runtime.Object { codec := legacyscheme.Codecs.LegacyCodec(v1alpha1.SchemeGroupVersion) data, err := runtime.Encode(codec, obj) if err != nil { t.Errorf("%v\n %#v", err, obj) return nil } obj2, err := runtime.Decode(codec, data) if err != nil { t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj) return nil } obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object) err = legacyscheme.Scheme.Convert(obj2, obj3, nil) if err != nil { t.Errorf("%v\nSource: %#v", err, obj2) return nil } return obj3 } func TestSetDefaultPreempting(t *testing.T) { priorityClass := &v1alpha1.PriorityClass{} // set NonPreemptingPriority true defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, true)() output := roundTrip(t, runtime.Object(priorityClass)).(*v1alpha1.PriorityClass) if output.PreemptionPolicy == nil || *output.PreemptionPolicy != apiv1.PreemptLowerPriority { t.Errorf("Expected PriorityClass.Preempting value: %+v\ngot: %+v\n", apiv1.PreemptLowerPriority, output.PreemptionPolicy) } }<|fim▁end|>
package v1alpha1_test import ( "reflect"
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import include, url from django.contrib import admin urlpatterns = [<|fim▁hole|> url(r'^admin/', admin.site.urls), url(r'^webcam/', include('webCam.urls')), ]<|fim▁end|>
<|file_name|>text-input-test.js<|end_file_name|><|fim▁begin|>import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render, fillIn } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; module('Integration | Component | inputs/text-input', function (hooks) { setupRenderingTest(hooks); hooks.beforeEach(async function () { this.config = {<|fim▁hole|> disabled: false, autocomplete: 'name', texts: { placeholder: 'Your name', }, }; await render(hbs`<Inputs::TextInput @config={{config}} />`); }); test('it renders', async function (assert) { assert.dom('textarea').hasAttribute('name', 'myInput'); assert.dom('textarea').hasAttribute('autocomplete', 'name'); assert.dom('textarea').hasAttribute('placeholder', 'Your name'); }); test('it updates value', async function (assert) { assert.dom('textarea').hasValue('123 hello'); this.set('config.value', 'hello?'); assert.dom('textarea').hasValue('hello?'); await fillIn('textarea', 'bye!'); assert.equal(this.config.value, 'bye!'); }); test('it can be disabled', async function (assert) { assert.dom('textarea').isNotDisabled(); this.set('config.disabled', true); assert.dom('textarea').isDisabled(); }); test('it supports presence validations', async function (assert) { assert.dom('textarea').doesNotHaveAttribute('required'); this.set('config.validations', { required: true }); assert.dom('textarea').hasAttribute('required'); }); });<|fim▁end|>
value: '123 hello', name: 'myInput',
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask<|fim▁hole|> app = Flask(__name__) bootstrap = Bootstrap() from .views import page def create_app(config): app.config.from_object(config) bootstrap.init_app(app) app.register_blueprint(page) return app<|fim▁end|>
from flask_bootstrap import Bootstrap
<|file_name|>test_image.py<|end_file_name|><|fim▁begin|># Authors: Emmanuelle Gouillart <[email protected]> # Gael Varoquaux <[email protected]> # License: BSD 3 clause import numpy as np import scipy as sp from scipy import ndimage from nose.tools import assert_equal, assert_true from numpy.testing import assert_raises from sklearn.feature_extraction.image import ( img_to_graph, grid_to_graph, extract_patches_2d, reconstruct_from_patches_2d, PatchExtractor, extract_patches) from sklearn.utils.graph import connected_components from sklearn.utils.testing import SkipTest from sklearn.utils.fixes import sp_version if sp_version < (0, 12): raise SkipTest("Skipping because SciPy version earlier than 0.12.0 and " "thus does not include the scipy.misc.face() image.") def test_img_to_graph(): x, y = np.mgrid[:4, :4] - 10 grad_x = img_to_graph(x) grad_y = img_to_graph(y) assert_equal(grad_x.nnz, grad_y.nnz) # Negative elements are the diagonal: the elements of the original # image. Positive elements are the values of the gradient, they # should all be equal on grad_x and grad_y np.testing.assert_array_equal(grad_x.data[grad_x.data > 0], grad_y.data[grad_y.data > 0]) def test_grid_to_graph(): # Checking that the function works with graphs containing no edges size = 2 roi_size = 1 # Generating two convex parts with one vertex # Thus, edges will be empty in _to_graph mask = np.zeros((size, size), dtype=np.bool) mask[0:roi_size, 0:roi_size] = True mask[-roi_size:, -roi_size:] = True mask = mask.reshape(size ** 2) A = grid_to_graph(n_x=size, n_y=size, mask=mask, return_as=np.ndarray) assert_true(connected_components(A)[0] == 2) # Checking that the function works whatever the type of mask is mask = np.ones((size, size), dtype=np.int16) A = grid_to_graph(n_x=size, n_y=size, n_z=size, mask=mask) assert_true(connected_components(A)[0] == 1) # Checking dtype of the graph mask = np.ones((size, size)) A = grid_to_graph(n_x=size, n_y=size, n_z=size, mask=mask, dtype=np.bool) assert_true(A.dtype == np.bool) A = grid_to_graph(n_x=size, n_y=size, n_z=size, mask=mask, dtype=np.int) assert_true(A.dtype == np.int) A = grid_to_graph(n_x=size, n_y=size, n_z=size, mask=mask, dtype=np.float64) assert_true(A.dtype == np.float64) def test_connect_regions(): try: face = sp.face(gray=True) except AttributeError: # Newer versions of scipy have face in misc from scipy import misc face = misc.face(gray=True) for thr in (50, 150): mask = face > thr graph = img_to_graph(face, mask) assert_equal(ndimage.label(mask)[1], connected_components(graph)[0]) def test_connect_regions_with_grid(): try: face = sp.face(gray=True) except AttributeError: # Newer versions of scipy have face in misc from scipy import misc face = misc.face(gray=True) mask = face > 50 graph = grid_to_graph(*face.shape, mask=mask) assert_equal(ndimage.label(mask)[1], connected_components(graph)[0]) mask = face > 150 graph = grid_to_graph(*face.shape, mask=mask, dtype=None) assert_equal(ndimage.label(mask)[1], connected_components(graph)[0]) def _downsampled_face(): try: face = sp.face(gray=True) except AttributeError: # Newer versions of scipy have face in misc from scipy import misc face = misc.face(gray=True) face = face.astype(np.float32) face = (face[::2, ::2] + face[1::2, ::2] + face[::2, 1::2] + face[1::2, 1::2]) face = (face[::2, ::2] + face[1::2, ::2] + face[::2, 1::2] + face[1::2, 1::2]) face = face.astype(np.float32) face /= 16.0 return face def _orange_face(face=None): face = _downsampled_face() if face is None else face face_color = np.zeros(face.shape + (3,)) face_color[:, :, 0] = 256 - face face_color[:, :, 1] = 256 - face / 2 face_color[:, :, 2] = 256 - face / 4 return face_color def _make_images(face=None): face = _downsampled_face() if face is None else face # make a collection of faces images = np.zeros((3,) + face.shape) images[0] = face images[1] = face + 1 images[2] = face + 2 return images downsampled_face = _downsampled_face() orange_face = _orange_face(downsampled_face) face_collection = _make_images(downsampled_face) def test_extract_patches_all(): face = downsampled_face i_h, i_w = face.shape p_h, p_w = 16, 16 expected_n_patches = (i_h - p_h + 1) * (i_w - p_w + 1) patches = extract_patches_2d(face, (p_h, p_w)) assert_equal(patches.shape, (expected_n_patches, p_h, p_w)) def test_extract_patches_all_color(): face = orange_face i_h, i_w = face.shape[:2] p_h, p_w = 16, 16 expected_n_patches = (i_h - p_h + 1) * (i_w - p_w + 1) patches = extract_patches_2d(face, (p_h, p_w)) assert_equal(patches.shape, (expected_n_patches, p_h, p_w, 3)) def test_extract_patches_all_rect(): face = downsampled_face face = face[:, 32:97] i_h, i_w = face.shape p_h, p_w = 16, 12 expected_n_patches = (i_h - p_h + 1) * (i_w - p_w + 1) patches = extract_patches_2d(face, (p_h, p_w)) assert_equal(patches.shape, (expected_n_patches, p_h, p_w)) def test_extract_patches_max_patches(): face = downsampled_face i_h, i_w = face.shape p_h, p_w = 16, 16 patches = extract_patches_2d(face, (p_h, p_w), max_patches=100) assert_equal(patches.shape, (100, p_h, p_w)) expected_n_patches = int(0.5 * (i_h - p_h + 1) * (i_w - p_w + 1)) patches = extract_patches_2d(face, (p_h, p_w), max_patches=0.5) assert_equal(patches.shape, (expected_n_patches, p_h, p_w)) assert_raises(ValueError, extract_patches_2d, face, (p_h, p_w), max_patches=2.0) assert_raises(ValueError, extract_patches_2d, face, (p_h, p_w), max_patches=-1.0) def test_reconstruct_patches_perfect(): face = downsampled_face p_h, p_w = 16, 16 patches = extract_patches_2d(face, (p_h, p_w)) face_reconstructed = reconstruct_from_patches_2d(patches, face.shape) np.testing.assert_array_almost_equal(face, face_reconstructed) def test_reconstruct_patches_perfect_color(): face = orange_face p_h, p_w = 16, 16 patches = extract_patches_2d(face, (p_h, p_w)) face_reconstructed = reconstruct_from_patches_2d(patches, face.shape) np.testing.assert_array_almost_equal(face, face_reconstructed) def test_patch_extractor_fit(): faces = face_collection extr = PatchExtractor(patch_size=(8, 8), max_patches=100, random_state=0) assert_true(extr == extr.fit(faces)) def test_patch_extractor_max_patches(): faces = face_collection i_h, i_w = faces.shape[1:3] p_h, p_w = 8, 8 max_patches = 100 expected_n_patches = len(faces) * max_patches extr = PatchExtractor(patch_size=(p_h, p_w), max_patches=max_patches, random_state=0) patches = extr.transform(faces) assert_true(patches.shape == (expected_n_patches, p_h, p_w)) max_patches = 0.5 expected_n_patches = len(faces) * int((i_h - p_h + 1) * (i_w - p_w + 1) * max_patches) extr = PatchExtractor(patch_size=(p_h, p_w), max_patches=max_patches, random_state=0) patches = extr.transform(faces) assert_true(patches.shape == (expected_n_patches, p_h, p_w)) def test_patch_extractor_max_patches_default(): faces = face_collection extr = PatchExtractor(max_patches=100, random_state=0) patches = extr.transform(faces) assert_equal(patches.shape, (len(faces) * 100, 19, 25)) def test_patch_extractor_all_patches(): faces = face_collection i_h, i_w = faces.shape[1:3] p_h, p_w = 8, 8 expected_n_patches = len(faces) * (i_h - p_h + 1) * (i_w - p_w + 1) extr = PatchExtractor(patch_size=(p_h, p_w), random_state=0) patches = extr.transform(faces) assert_true(patches.shape == (expected_n_patches, p_h, p_w)) def test_patch_extractor_color(): faces = _make_images(orange_face) i_h, i_w = faces.shape[1:3] p_h, p_w = 8, 8 expected_n_patches = len(faces) * (i_h - p_h + 1) * (i_w - p_w + 1) extr = PatchExtractor(patch_size=(p_h, p_w), random_state=0) patches = extr.transform(faces) assert_true(patches.shape == (expected_n_patches, p_h, p_w, 3)) def test_extract_patches_strided(): image_shapes_1D = [(10,), (10,), (11,), (10,)] patch_sizes_1D = [(1,), (2,), (3,), (8,)] patch_steps_1D = [(1,), (1,), (4,), (2,)] expected_views_1D = [(10,), (9,), (3,), (2,)] last_patch_1D = [(10,), (8,), (8,), (2,)] image_shapes_2D = [(10, 20), (10, 20), (10, 20), (11, 20)] patch_sizes_2D = [(2, 2), (10, 10), (10, 11), (6, 6)] patch_steps_2D = [(5, 5), (3, 10), (3, 4), (4, 2)] expected_views_2D = [(2, 4), (1, 2), (1, 3), (2, 8)] last_patch_2D = [(5, 15), (0, 10), (0, 8), (4, 14)] image_shapes_3D = [(5, 4, 3), (3, 3, 3), (7, 8, 9), (7, 8, 9)] patch_sizes_3D = [(2, 2, 3), (2, 2, 2), (1, 7, 3), (1, 3, 3)] patch_steps_3D = [(1, 2, 10), (1, 1, 1), (2, 1, 3), (3, 3, 4)] expected_views_3D = [(4, 2, 1), (2, 2, 2), (4, 2, 3), (3, 2, 2)] last_patch_3D = [(3, 2, 0), (1, 1, 1), (6, 1, 6), (6, 3, 4)] image_shapes = image_shapes_1D + image_shapes_2D + image_shapes_3D patch_sizes = patch_sizes_1D + patch_sizes_2D + patch_sizes_3D patch_steps = patch_steps_1D + patch_steps_2D + patch_steps_3D expected_views = expected_views_1D + expected_views_2D + expected_views_3D last_patches = last_patch_1D + last_patch_2D + last_patch_3D for (image_shape, patch_size, patch_step, expected_view, last_patch) in zip(image_shapes, patch_sizes, patch_steps, expected_views, last_patches): image = np.arange(np.prod(image_shape)).reshape(image_shape) patches = extract_patches(image, patch_shape=patch_size, extraction_step=patch_step) ndim = len(image_shape) assert_true(patches.shape[:ndim] == expected_view) last_patch_slices = [slice(i, i + j, None) for i, j in zip(last_patch, patch_size)] assert_true((patches[[slice(-1, None, None)] * ndim] == image[last_patch_slices].squeeze()).all()) def test_extract_patches_square(): # test same patch size for all dimensions face = downsampled_face i_h, i_w = face.shape p = 8 expected_n_patches = ((i_h - p + 1), (i_w - p + 1)) patches = extract_patches(face, patch_shape=p) assert_true(patches.shape == (expected_n_patches[0], expected_n_patches[1], p, p)) def test_width_patch(): # width and height of the patch should be less than the image x = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])<|fim▁hole|> assert_raises(ValueError, extract_patches_2d, x, (1, 4))<|fim▁end|>
assert_raises(ValueError, extract_patches_2d, x, (4, 1))
<|file_name|>users.service.ts<|end_file_name|><|fim▁begin|>import { Injectable } from '@angular/core';<|fim▁hole|> @Injectable() export class UsersService { constructor(private http: Http) { } usersData = [{ 'uid': '23554654235325', 'firstname': 'Firstname 1', 'lastname': 'Lastname 1', 'email': '[email protected]', 'pseudo': "Pseudo 1", 'birthdate': 2017-12-13, 'created_at': 2017-12-13, 'updated_at': 2017-12-13, 'deleted_at': 2017-12-13 },{ 'uid': '23554654235325', 'firstname': 'Firstname 2', 'lastname': 'Lastname 2', 'email': '[email protected]', 'pseudo': "Pseudo 2", 'birthdate': 2017-12-13, 'created_at': 2017-12-13, 'updated_at': 2017-12-13, 'deleted_at': 2017-12-13 },{ 'uid': '23554654235325', 'firstname': 'Firstname 3', 'lastname': 'Lastname 3', 'email': '[email protected]', 'pseudo': "Pseudo 3", 'birthdate': 2017-12-13, 'created_at': 2017-12-13, 'updated_at': 2017-12-13, 'deleted_at': 2017-12-13 }]; getData(): Promise<any> { return new Promise((resolve, reject) => { setTimeout(() => { resolve(this.usersData); }, 1); }); } getOne(): Promise<any> { return new Promise((resolve, reject) => { setTimeout(() => { resolve(this.usersData[0]); }, 1); }); } getAll() { return this.http.get('http://51.255.196.182:3000/user', this.jwt()).map((response: Response) => response.json()); } getById(id: number) { return this.http.get('http://51.255.196.182:3000/user/' + id, this.jwt()).map((response: Response) => response.json()); } refresh(id: string) { return this.http.get('http://localhost:4040/api/servers/refresh/' + id, this.jwt()).map((response: Response) => response.json()); } version(id: string) { return this.http.get('http://localhost:4040/api/servers/version/' + id, this.jwt()).map((response: Response) => response.json()); } create(user: User) { return this.http.post('http://localhost:4040/api/servers', user, this.jwt()).map((response: Response) => response.json()); } update(user: User) { return this.http.put('http://localhost:4040/api/servers/' + user.uid, user, this.jwt()).map((response: Response) => response.json()); } delete(id: number) { return this.http.delete('/api/servers/' + id, this.jwt()).map((response: Response) => response.json()); } // private helper methods private jwt() { // create authorization header with jwt token let currentUser = JSON.parse(localStorage.getItem('currentUser')); if (currentUser && currentUser.token) { let headers = new Headers({ 'Authorization': 'Bearer ' + currentUser.token }); return new RequestOptions({ headers: headers }); } } }<|fim▁end|>
import { Http, Headers, RequestOptions, Response } from '@angular/http'; import { User } from './_models/index';
<|file_name|>device_test.go<|end_file_name|><|fim▁begin|>package netio import ( "github.com/brutella/hc/db" "os" "reflect" "testing" ) <|fim▁hole|> var e db.Entity var client Device var err error database, _ := db.NewDatabase(os.TempDir()) client, err = NewDevice("Test Client", database) if err != nil { t.Fatal(err) } if x := len(client.PublicKey()); x == 0 { t.Fatal(x) } if x := len(client.PrivateKey()); x == 0 { t.Fatal(x) } if e, err = database.EntityWithName("Test Client"); err != nil { t.Fatal(err) } if is, want := e.Name, "Test Client"; is != want { t.Fatalf("is=%v want=%v", is, want) } if err != nil { t.Fatal(err) } if is, want := e.PublicKey, client.PublicKey(); reflect.DeepEqual(is, want) == false { t.Fatalf("is=%v want=%v", is, want) } if is, want := e.PrivateKey, client.PrivateKey(); reflect.DeepEqual(is, want) == false { t.Fatalf("is=%v want=%v", is, want) } }<|fim▁end|>
func TestNewDevice(t *testing.T) {
<|file_name|>eventtypes.js<|end_file_name|><|fim▁begin|>'use strict'; /** * Types of events * @readonly * @enum {number} */ var EventTypes = { // Channel Events /** * A channel got connected * @type {EventType} */ CONNECT: "connect", /** * A channel got disconnected */ DISCONNECT: "disconnect", /** * A channel got reconnected */ RECONNECT: "reconnect", /** * A channel is attempting to reconnect */ RECONNECTATTEMPT: "reconnect_attempt", /** * chatMode */ CHATMODE: "chatMode", /** * A list of current users in a channel */ CHANNELUSERS: "channelUsers", /** * A server message */ SERVERMESSAGE: "srvMsg", /** * A user message */ USERMESSAGE: "userMsg", /** * A /me message */ MEMESSAGE: "meMsg", /** * A /me message */ WHISPER: "whisper", /** * A global message */<|fim▁hole|> */ CLEARCHAT: "clearChat", /** * A request for built-in command help */ COMMANDHELP: "commandHelp", /** * Whether or not mod tools should be visible */ MODTOOLSVISIBLE: "modToolsVisible", /** * A list of current mods in a channel */ MODLIST: "modList", /** * The color of the bot's name in chat */ COLOR: "color", /** * The online state of a stream */ ONLINESTATE: "onlineState", /** * A list of users included in a raffle */ RAFFLEUSERS: "raffleUsers", /** * The winner of a raffle */ WONRAFFLE: "wonRaffle", /** * runPoll */ RUNPOLL: "runPoll", /** * showPoll */ SHOWPOLL: "showPoll", /** * pollVotes */ POLLVOTES: "pollVotes", /** * voteResponse */ VOTERESPONSE: "voteResponse", /** * finishPoll */ FINISHPOLL: "finishPoll", /** * gameMode */ GAMEMODE: "gameMode", /** * adultMode */ ADULTMODE: "adultMode", /** * commissionsAvailable */ COMMISSIONSAVAILABLE: "commissionsAvailable", /** * clearUser */ CLEARUSER: "clearUser", /** * removeMsg */ REMOVEMESSAGE: "removeMsg", /** * A PTVAdmin? warning that a channel has adult content but is not in adult mode. */ WARNADULT: "warnAdult", /** * A PTVAdmin? warning that a channel has gaming content but is not in gaming mode. */ WARNGAMING: "warnGaming", /** * A PTVAdmin? warning that a channel has movie content. */ WARNMOVIES: "warnMovies", /** * The multistream status of a channel */ MULTISTATUS: "multiStatus", /** * Emitted after replaying chat history */ ENDHISTORY: "endHistory", /** * A list of people being ignored */ IGNORES: "ignores", // Bot Events /** * The bot threw an exception */ EXCEPTION: "exception", /** * A bot command */ CHATCOMMAND: "chatCommand", /** * A console command */ CONSOLECOMMAND: "consoleCommand", /** * A command needs completing */ COMMANDCOMPLETION: "commandCompletion", /** * A plugin was loaded */ PLUGINLOADED: "pluginLoaded", /** * A plugin was started */ PLUGINSTARTED: "pluginStarted", /** * A plugin was loaded */ PLUGINUNLOADED: "pluginUnloaded", /** * A plugin was started */ PLUGINSTOPPED: "pluginStopped", /** * Used to query plugins if they want to add a cli option/flag */ CLIOPTIONS: "CLIOptions" }; module.exports = EventTypes;<|fim▁end|>
GLOBALMESSAGE: "globalMsg", /** * An instruction/request to clear chat history
<|file_name|>forum.js<|end_file_name|><|fim▁begin|>/* [Discuz!] (C)2001-2099 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: forum.js 33082 2013-04-18 11:13:53Z zhengqingpeng $ */ function saveData(ignoreempty) { var ignoreempty = isUndefined(ignoreempty) ? 0 : ignoreempty; var obj = $('postform') && (($('fwin_newthread') && $('fwin_newthread').style.display == '') || ($('fwin_reply') && $('fwin_reply').style.display == '')) ? $('postform') : ($('fastpostform') ? $('fastpostform') : $('postform')); if(!obj) return; if(typeof isfirstpost != 'undefined') { if(typeof wysiwyg != 'undefined' && wysiwyg == 1) { var messageisnull = trim(html2bbcode(editdoc.body.innerHTML)) === ''; } else { var messageisnull = $('postform').message.value === ''; } if(isfirstpost && (messageisnull && $('postform').subject.value === '')) { return; } if(!isfirstpost && messageisnull) { return; } } var data = subject = message = ''; for(var i = 0; i < obj.elements.length; i++) { var el = obj.elements[i]; if(el.name != '' && (el.tagName == 'SELECT' || el.tagName == 'TEXTAREA' || el.tagName == 'INPUT' && (el.type == 'text' || el.type == 'checkbox' || el.type == 'radio' || el.type == 'hidden' || el.type == 'select')) && el.name.substr(0, 6) != 'attach') { var elvalue = el.value; if(el.name == 'subject') { subject = trim(elvalue); } else if(el.name == 'message') { if(typeof wysiwyg != 'undefined' && wysiwyg == 1) { elvalue = html2bbcode(editdoc.body.innerHTML); } message = trim(elvalue); } if((el.type == 'checkbox' || el.type == 'radio') && !el.checked) { continue; } else if(el.tagName == 'SELECT') { elvalue = el.value; } else if(el.type == 'hidden') { if(el.id) { eval('var check = typeof ' + el.id + '_upload == \'function\''); if(check) { elvalue = elvalue; if($(el.id + '_url')) { elvalue += String.fromCharCode(1) + $(el.id + '_url').value; } } else { continue; } } else { continue; } } if(trim(elvalue)) { data += el.name + String.fromCharCode(9) + el.tagName + String.fromCharCode(9) + el.type + String.fromCharCode(9) + elvalue + String.fromCharCode(9, 9); } } } if(!subject && !message && !ignoreempty) { return; } saveUserdata('forum_'+discuz_uid, data); } function fastUload() { appendscript(JSPATH + 'forum_post.js?' + VERHASH); safescript('forum_post_js', function () { uploadWindow(function (aid, url) {updatefastpostattach(aid, url)}, 'file') }, 100, 50); } function switchAdvanceMode(url) { var obj = $('postform') && (($('fwin_newthread') && $('fwin_newthread').style.display == '') || ($('fwin_reply') && $('fwin_reply').style.display == '')) ? $('postform') : $('fastpostform'); if(obj && obj.message.value != '') { saveData(); url += (url.indexOf('?') != -1 ? '&' : '?') + 'cedit=yes'; } location.href = url; return false; } function sidebar_collapse(lang) { if(lang[0]) { toggle_collapse('sidebar', null, null, lang); $('wrap').className = $('wrap').className == 'wrap with_side s_clear' ? 'wrap s_clear' : 'wrap with_side s_clear'; } else { var collapsed = getcookie('collapse'); collapsed = updatestring(collapsed, 'sidebar', 1); setcookie('collapse', collapsed, (collapsed ? 2592000 : -2592000)); location.reload(); } } function keyPageScroll(e, prev, next, url, page) { if(loadUserdata('is_blindman')) { return true; } e = e ? e : window.event; var tagname = BROWSER.ie ? e.srcElement.tagName : e.target.tagName; if(tagname == 'INPUT' || tagname == 'TEXTAREA') return; actualCode = e.keyCode ? e.keyCode : e.charCode; if(next && actualCode == 39) { window.location = url + '&page=' + (page + 1); } if(prev && actualCode == 37) { window.location = url + '&page=' + (page - 1); } } function announcement() { var ann = new Object(); ann.anndelay = 3000;ann.annst = 0;ann.annstop = 0;ann.annrowcount = 0;ann.anncount = 0;ann.annlis = $('anc').getElementsByTagName("li");ann.annrows = new Array(); ann.announcementScroll = function () { if(this.annstop) {this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay);return;} if(!this.annst) { var lasttop = -1; for(i = 0;i < this.annlis.length;i++) { if(lasttop != this.annlis[i].offsetTop) { if(lasttop == -1) lasttop = 0; this.annrows[this.annrowcount] = this.annlis[i].offsetTop - lasttop;this.annrowcount++; } lasttop = this.annlis[i].offsetTop; } if(this.annrows.length == 1) { $('an').onmouseover = $('an').onmouseout = null; } else { this.annrows[this.annrowcount] = this.annrows[1]; $('ancl').innerHTML += $('ancl').innerHTML; this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay); $('an').onmouseover = function () {ann.annstop = 1;}; $('an').onmouseout = function () {ann.annstop = 0;}; } this.annrowcount = 1; return; } if(this.annrowcount >= this.annrows.length) { $('anc').scrollTop = 0; this.annrowcount = 1; this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay); } else { this.anncount = 0; this.announcementScrollnext(this.annrows[this.annrowcount]); } }; ann.announcementScrollnext = function (time) { $('anc').scrollTop++; this.anncount++; if(this.anncount != time) { this.annst = setTimeout(function () {ann.announcementScrollnext(time);}, 10); } else { this.annrowcount++; this.annst = setTimeout(function () {ann.announcementScroll();}, this.anndelay); } }; ann.announcementScroll(); } function removeindexheats() { return confirm('You to confirm that this topic should remove it from the hot topic?'); } function showTypes(id, mod) { var o = $(id); if(!o) return false; var s = o.className; mod = isUndefined(mod) ? 1 : mod; var baseh = o.getElementsByTagName('li')[0].offsetHeight * 2; var tmph = o.offsetHeight; var lang = ['Expansion', 'Collapse']; var cls = ['unfold', 'fold']; if(tmph > baseh) { var octrl = document.createElement('li'); octrl.className = cls[mod]; octrl.innerHTML = lang[mod]; o.insertBefore(octrl, o.firstChild); o.className = s + ' cttp'; mod && (o.style.height = 'auto'); octrl.onclick = function () { if(this.className == cls[0]) { o.style.height = 'auto'; this.className = cls[1]; this.innerHTML = lang[1]; } else { o.style.height = ''; <|fim▁hole|> } } var postpt = 0; function fastpostvalidate(theform, noajaxpost) { if(postpt) { return false; } postpt = 1; setTimeout(function() {postpt = 0}, 2000); noajaxpost = !noajaxpost ? 0 : noajaxpost; s = ''; if(typeof fastpostvalidateextra == 'function') { var v = fastpostvalidateextra(); if(!v) { return false; } } if(theform.message.value == '' || theform.subject.value == '') { s = 'Sorry, you can not enter a title or content'; theform.message.focus(); } else if(mb_strlen(theform.subject.value) > 80) { s = 'Your title is longer than 80 characters limit'; theform.subject.focus(); } if(!disablepostctrl && ((postminchars != 0 && mb_strlen(theform.message.value) < postminchars) || (postmaxchars != 0 && mb_strlen(theform.message.value) > postmaxchars))) { s = 'Not meet the requirements of the length of your posts.\n\nCurrent length: ' + mb_strlen(theform.message.value) + ' ' + 'Byte\nSystem limits: ' + postminchars + ' to ' + postmaxchars + ' Byte'; } if(s) { showError(s); doane(); $('fastpostsubmit').disabled = false; return false; } $('fastpostsubmit').disabled = true; theform.message.value = theform.message.value.replace(/([^>=\]"'\/]|^)((((https?|ftp):\/\/)|www\.)([\w\-]+\.)*[\w\-\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!]*)+\.(jpg|gif|png|bmp))/ig, '$1[img]$2[/img]'); theform.message.value = parseurl(theform.message.value); if(!noajaxpost) { ajaxpost('fastpostform', 'fastpostreturn', 'fastpostreturn', 'onerror', $('fastpostsubmit')); return false; } else { return true; } } function updatefastpostattach(aid, url) { ajaxget('forum.php?mod=ajax&action=attachlist&posttime=' + $('posttime').value + (!fid ? '' : '&fid=' + fid), 'attachlist'); $('attach_tblheader').style.display = ''; } function succeedhandle_fastnewpost(locationhref, message, param) { location.href = locationhref; } function errorhandle_fastnewpost() { $('fastpostsubmit').disabled = false; } function atarget(obj) { obj.target = getcookie('atarget') > 0 ? '_blank' : ''; } function setatarget(v) { $('atarget').className = 'y atarget_' + v; $('atarget').onclick = function() {setatarget(v == 1 ? -1 : 1);}; setcookie('atarget', v, 2592000); } function loadData(quiet, formobj) { var evalevent = function (obj) { var script = obj.parentNode.innerHTML; var re = /onclick="(.+?)["|>]/ig; var matches = re.exec(script); if(matches != null) { matches[1] = matches[1].replace(/this\./ig, 'obj.'); eval(matches[1]); } }; var data = ''; data = loadUserdata('forum_'+discuz_uid); var formobj = !formobj ? $('postform') : formobj; if(in_array((data = trim(data)), ['', 'null', 'false', null, false])) { if(!quiet) { showDialog('No data can be restored!', 'info'); } return; } if(!quiet && !confirm('This action will overwrite the current content of the post, You sure you want to recover data?')) { return; } var data = data.split(/\x09\x09/); for(var i = 0; i < formobj.elements.length; i++) { var el = formobj.elements[i]; if(el.name != '' && (el.tagName == 'SELECT' || el.tagName == 'TEXTAREA' || el.tagName == 'INPUT' && (el.type == 'text' || el.type == 'checkbox' || el.type == 'radio' || el.type == 'hidden'))) { for(var j = 0; j < data.length; j++) { var ele = data[j].split(/\x09/); if(ele[0] == el.name) { elvalue = !isUndefined(ele[3]) ? ele[3] : ''; if(ele[1] == 'INPUT') { if(ele[2] == 'text') { el.value = elvalue; } else if((ele[2] == 'checkbox' || ele[2] == 'radio') && ele[3] == el.value) { el.checked = true; evalevent(el); } else if(ele[2] == 'hidden') { eval('var check = typeof ' + el.id + '_upload == \'function\''); if(check) { var v = elvalue.split(/\x01/); el.value = v[0]; if(el.value) { if($(el.id + '_url') && v[1]) { $(el.id + '_url').value = v[1]; } eval(el.id + '_upload(\'' + v[0] + '\', \'' + v[1] + '\')'); if($('unused' + v[0])) { var attachtype = $('unused' + v[0]).parentNode.parentNode.parentNode.parentNode.id.substr(11); $('unused' + v[0]).parentNode.parentNode.outerHTML = ''; $('unusednum_' + attachtype).innerHTML = parseInt($('unusednum_' + attachtype).innerHTML) - 1; if($('unusednum_' + attachtype).innerHTML == 0 && $('attachnotice_' + attachtype)) { $('attachnotice_' + attachtype).style.display = 'none'; } } } } } } else if(ele[1] == 'TEXTAREA') { if(ele[0] == 'message') { if(!wysiwyg) { textobj.value = elvalue; } else { editdoc.body.innerHTML = bbcode2html(elvalue); } } else { el.value = elvalue; } } else if(ele[1] == 'SELECT') { if($(el.id + '_ctrl_menu')) { var lis = $(el.id + '_ctrl_menu').getElementsByTagName('li'); for(var k = 0; k < lis.length; k++) { if(ele[3] == lis[k].k_value) { lis[k].onclick(); break; } } } else { for(var k = 0; k < el.options.length; k++) { if(ele[3] == el.options[k].value) { el.options[k].selected = true; break; } } } } break; } } } } if($('rstnotice')) { $('rstnotice').style.display = 'none'; } extraCheckall(); } var checkForumcount = 0, checkForumtimeout = 30000, checkForumnew_handle; function checkForumnew(fid, lasttime) { var timeout = checkForumtimeout; var x = new Ajax(); x.get('forum.php?mod=ajax&action=forumchecknew&fid=' + fid + '&time=' + lasttime + '&inajax=yes', function(s){ if(s > 0) { var table = $('separatorline').parentNode; if(!isUndefined(checkForumnew_handle)) { clearTimeout(checkForumnew_handle); } removetbodyrow(table, 'forumnewshow'); var colspan = table.getElementsByTagName('tbody')[0].rows[0].children.length; var checknew = {'tid':'', 'thread':{'common':{'className':'', 'val':'<a href="javascript:void(0);" onclick="ajaxget(\'forum.php?mod=ajax&action=forumchecknew&fid=' + fid+ '&time='+lasttime+'&uncheck=1&inajax=yes\', \'forumnew\');">New topic Reply, Click to view', 'colspan': colspan }}}; addtbodyrow(table, ['tbody'], ['forumnewshow'], 'separatorline', checknew); } else { if(checkForumcount < 50) { if(checkForumcount > 0) { var multiple = Math.ceil(50 / checkForumcount); if(multiple < 5) { timeout = checkForumtimeout * (5 - multiple + 1); } } checkForumnew_handle = setTimeout(function () {checkForumnew(fid, lasttime);}, timeout); } } checkForumcount++; }); } function checkForumnew_btn(fid) { if(isUndefined(fid)) return; ajaxget('forum.php?mod=ajax&action=forumchecknew&fid=' + fid+ '&time='+lasttime+'&uncheck=2&inajax=yes', 'forumnew', 'ajaxwaitid'); lasttime = parseInt(Date.parse(new Date()) / 1000); } function addtbodyrow (table, insertID, changename, separatorid, jsonval) { if(isUndefined(table) || isUndefined(insertID[0])) { return; } var insertobj = document.createElement(insertID[0]); var thread = jsonval.thread; var tid = !isUndefined(jsonval.tid) ? jsonval.tid : '' ; if(!isUndefined(changename[1])) { removetbodyrow(table, changename[1] + tid); } insertobj.id = changename[0] + tid; if(!isUndefined(insertID[1])) { insertobj.className = insertID[1]; } if($(separatorid)) { table.insertBefore(insertobj, $(separatorid).nextSibling); } else { table.insertBefore(insertobj, table.firstChild); } var newTH = insertobj.insertRow(-1); for(var value in thread) { if(value != 0) { var cell = newTH.insertCell(-1); if(isUndefined(thread[value]['val'])) { cell.innerHTML = thread[value]; } else { cell.innerHTML = thread[value]['val']; } if(!isUndefined(thread[value]['className'])) { cell.className = thread[value]['className']; } if(!isUndefined(thread[value]['colspan'])) { cell.colSpan = thread[value]['colspan']; } } } if(!isUndefined(insertID[2])) { _attachEvent(insertobj, insertID[2], function() {insertobj.className = '';}); } } function removetbodyrow(from, objid) { if(!isUndefined(from) && $(objid)) { from.removeChild($(objid)); } } function leftside(id) { $(id).className = $(id).className == 'a' ? '' : 'a'; if(id == 'lf_fav') { setcookie('leftsidefav', $(id).className == 'a' ? 0 : 1, 2592000); } } var DTimers = new Array(); var DItemIDs = new Array(); var DTimers_exists = false; function settimer(timer, itemid) { if(timer && itemid) { DTimers.push(timer); DItemIDs.push(itemid); } if(!DTimers_exists) { setTimeout("showtime()", 1000); DTimers_exists = true; } } function showtime() { for(i=0; i<=DTimers.length; i++) { if(DItemIDs[i]) { if(DTimers[i] == 0) { $(DItemIDs[i]).innerHTML = 'Has ended'; DItemIDs[i] = ''; continue; } var timestr = ''; var timer_day = Math.floor(DTimers[i] / 86400); var timer_hour = Math.floor((DTimers[i] % 86400) / 3600); var timer_minute = Math.floor(((DTimers[i] % 86400) % 3600) / 60); var timer_second = (((DTimers[i] % 86400) % 3600) % 60); if(timer_day > 0) { timestr += timer_day + 'Day'; } if(timer_hour > 0) { timestr += timer_hour + 'Hour' } if(timer_minute > 0) { timestr += timer_minute + 'Min.' } if(timer_second > 0) { timestr += timer_second + 'Sec.' } DTimers[i] = DTimers[i] - 1; $(DItemIDs[i]).innerHTML = timestr; } } setTimeout("showtime()", 1000); } function fixed_top_nv(eleid, disbind) { this.nv = eleid && $(eleid) || $('nv'); this.openflag = this.nv && BROWSER.ie != 6; this.nvdata = {}; this.init = function (disattachevent) { if(this.openflag) { if(!disattachevent) { var obj = this; _attachEvent(window, 'resize', function(){obj.reset();obj.init(1);obj.run();}); var switchwidth = $('switchwidth'); if(switchwidth) { _attachEvent(switchwidth, 'click', function(){obj.reset();obj.openflag=false;}); } } var next = this.nv; try { while((next = next.nextSibling).nodeType != 1 || next.style.display === 'none') {} this.nvdata.next = next; this.nvdata.height = parseInt(this.nv.offsetHeight, 10); this.nvdata.width = parseInt(this.nv.offsetWidth, 10); this.nvdata.left = this.nv.getBoundingClientRect().left - document.documentElement.clientLeft; this.nvdata.position = this.nv.style.position; this.nvdata.opacity = this.nv.style.opacity; } catch (e) { this.nvdata.next = null; } } }; this.run = function () { var fixedheight = 0; if(this.openflag && this.nvdata.next){ var nvnexttop = document.body.scrollTop || document.documentElement.scrollTop; var dofixed = nvnexttop !== 0 && document.documentElement.clientHeight >= 15 && this.nvdata.next.getBoundingClientRect().top - this.nvdata.height < 0; if(dofixed) { if(this.nv.style.position != 'fixed') { this.nv.style.borderLeftWidth = '0'; this.nv.style.borderRightWidth = '0'; this.nv.style.height = this.nvdata.height + 'px'; this.nv.style.width = this.nvdata.width + 'px'; this.nv.style.top = '0'; this.nv.style.left = this.nvdata.left + 'px'; this.nv.style.position = 'fixed'; this.nv.style.zIndex = '199'; this.nv.style.opacity = 0.85; } } else { if(this.nv.style.position != this.nvdata.position) { this.reset(); } } if(this.nv.style.position == 'fixed') { fixedheight = this.nvdata.height; } } return fixedheight; }; this.reset = function () { if(this.nv) { this.nv.style.position = this.nvdata.position; this.nv.style.borderLeftWidth = ''; this.nv.style.borderRightWidth = ''; this.nv.style.height = ''; this.nv.style.width = ''; this.nv.style.opacity = this.nvdata.opacity; } }; if(!disbind && this.openflag) { this.init(); _attachEvent(window, 'scroll', this.run); } } var previewTbody = null, previewTid = null, previewDiv = null; function previewThread(tid, tbody) { if(!$('threadPreviewTR_'+tid)) { appendscript(JSPATH + 'forum_viewthread.js?' + VERHASH); newTr = document.createElement('tr'); newTr.id = 'threadPreviewTR_'+tid; newTr.className = 'threadpre'; $(tbody).appendChild(newTr); newTd = document.createElement('td'); newTd.colSpan = listcolspan; newTd.className = 'threadpretd'; newTr.appendChild(newTd); newTr.style.display = 'none'; previewTbody = tbody; previewTid = tid; if(BROWSER.ie) { previewDiv = document.createElement('div'); previewDiv.id = 'threadPreview_'+tid; previewDiv.style.id = 'none'; var x = Ajax(); x.get('forum.php?mod=viewthread&tid='+tid+'&inajax=1&from=preview', function(ret) { var evaled = false; if(ret.indexOf('ajaxerror') != -1) { evalscript(ret); evaled = true; } previewDiv.innerHTML = ret; newTd.appendChild(previewDiv); if(!evaled) evalscript(ret); newTr.style.display = ''; }); } else { newTd.innerHTML += '<div id="threadPreview_'+tid+'"></div>'; ajaxget('forum.php?mod=viewthread&tid='+tid+'&from=preview', 'threadPreview_'+tid, null, null, null, function() {newTr.style.display = '';}); } } else { $(tbody).removeChild($('threadPreviewTR_'+tid)); previewTbody = previewTid = null; } } function hideStickThread(tid) { var pre = 'stickthread_'; var tids = (new Function("return ("+(loadUserdata('sticktids') || '[]')+")"))(); var format = function (data) { var str = '{'; for (var i in data) { if(data[i] instanceof Array) { str += i + ':' + '['; for (var j = data[i].length - 1; j >= 0; j--) { str += data[i][j] + ','; }; str = str.substr(0, str.length -1); str += '],'; } } str = str.substr(0, str.length -1); str += '}'; return str; }; if(!tid) { if(tids.length > 0) { for (var i = tids.length - 1; i >= 0; i--) { var ele = $(pre+tids[i]); if(ele) { ele.parentNode.removeChild(ele); } }; } } else { var eletbody = $(pre+tid); if(eletbody) { eletbody.parentNode.removeChild(eletbody); tids.push(tid); saveUserdata('sticktids', '['+tids.join(',')+']'); } } var clearstickthread = $('clearstickthread'); if(clearstickthread) { if(tids.length > 0) { $('clearstickthread').style.display = ''; } else { $('clearstickthread').style.display = 'none'; } } var separatorline = $('separatorline'); if(separatorline) { try { if(typeof separatorline.previousElementSibling === 'undefined') { var findele = separatorline.previousSibling; while(findele && findele.nodeType != 1){ findele = findele.previousSibling; } if(findele === null) { separatorline.parentNode.removeChild(separatorline); } } else { if(separatorline.previousElementSibling === null) { separatorline.parentNode.removeChild(separatorline); } } } catch(e) { } } } function viewhot() { var obj = $('hottime'); window.location.href = "forum.php?mod=forumdisplay&filter=hot&fid="+obj.getAttribute('fid')+"&time="+obj.value; } function clearStickThread () { saveUserdata('sticktids', '[]'); location.reload(); }<|fim▁end|>
this.className = cls[0]; this.innerHTML = lang[0]; } }
<|file_name|>data.go<|end_file_name|><|fim▁begin|>// Copyright 2017 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package data import ( "bytes" "encoding/csv" "encoding/json" "errors" "net/http" "strings" "time" "github.com/spf13/hugo/deps" jww "github.com/spf13/jwalterweatherman" ) // New returns a new instance of the data-namespaced template functions. func New(deps *deps.Deps) *Namespace { return &Namespace{ deps: deps, client: http.DefaultClient, } } // Namespace provides template functions for the "data" namespace. type Namespace struct { deps *deps.Deps client *http.Client } // GetCSV expects a data separator and one or n-parts of a URL to a resource which // can either be a local or a remote one. // The data separator can be a comma, semi-colon, pipe, etc, but only one character. // If you provide multiple parts for the URL they will be joined together to the final URL. // GetCSV returns nil or a slice slice to use in a short code. func (ns *Namespace) GetCSV(sep string, urlParts ...string) (d [][]string, err error) { url := strings.Join(urlParts, "") var clearCacheSleep = func(i int, u string) { jww.ERROR.Printf("Retry #%d for %s and sleeping for %s", i, url, resSleep) time.Sleep(resSleep) deleteCache(url, ns.deps.Fs.Source, ns.deps.Cfg) } for i := 0; i <= resRetries; i++ { var req *http.Request req, err = http.NewRequest("GET", url, nil) if err != nil { jww.ERROR.Printf("Failed to create request for getJSON: %s", err) return nil, err } req.Header.Add("Accept", "text/csv") req.Header.Add("Accept", "text/plain") var c []byte c, err = ns.getResource(req) if err != nil { jww.ERROR.Printf("Failed to read csv resource %q with error message %s", url, err) return nil, err } if !bytes.Contains(c, []byte(sep)) { err = errors.New("Cannot find separator " + sep + " in CSV.") return } if d, err = parseCSV(c, sep); err != nil { jww.ERROR.Printf("Failed to parse csv file %s with error message %s", url, err) clearCacheSleep(i, url) continue } break } return } // GetJSON expects one or n-parts of a URL to a resource which can either be a local or a remote one. // If you provide multiple parts they will be joined together to the final URL. // GetJSON returns nil or parsed JSON to use in a short code. func (ns *Namespace) GetJSON(urlParts ...string) (v interface{}, err error) { url := strings.Join(urlParts, "") for i := 0; i <= resRetries; i++ { var req *http.Request req, err = http.NewRequest("GET", url, nil) if err != nil { jww.ERROR.Printf("Failed to create request for getJSON: %s", err) return nil, err } req.Header.Add("Accept", "application/json") var c []byte c, err = ns.getResource(req) if err != nil { jww.ERROR.Printf("Failed to get json resource %s with error message %s", url, err) return nil, err } err = json.Unmarshal(c, &v) if err != nil { jww.ERROR.Printf("Cannot read json from resource %s with error message %s", url, err) jww.ERROR.Printf("Retry #%d for %s and sleeping for %s", i, url, resSleep) time.Sleep(resSleep) deleteCache(url, ns.deps.Fs.Source, ns.deps.Cfg) continue } break } return } // parseCSV parses bytes of CSV data into a slice slice string or an error<|fim▁hole|>func parseCSV(c []byte, sep string) ([][]string, error) { if len(sep) != 1 { return nil, errors.New("Incorrect length of csv separator: " + sep) } b := bytes.NewReader(c) r := csv.NewReader(b) rSep := []rune(sep) r.Comma = rSep[0] r.FieldsPerRecord = 0 return r.ReadAll() }<|fim▁end|>
<|file_name|>mouse.rs<|end_file_name|><|fim▁begin|>//! Back-end agnostic mouse buttons. use num::{ FromPrimitive, ToPrimitive }; /// Represent a mouse button. #[derive(Copy, Clone, RustcDecodable, RustcEncodable, PartialEq, Eq, Ord, PartialOrd, Hash, Debug)] pub enum MouseButton { /// Unknown mouse button. Unknown, /// Left mouse button. Left, /// Right mouse button. Right, /// Middle mouse button. Middle, /// Extra mouse button number 1. X1, /// Extra mouse button number 2. X2, /// Mouse button number 6. Button6, /// Mouse button number 7. Button7, /// Mouse button number 8. Button8, } impl FromPrimitive for MouseButton { fn from_u64(n: u64) -> Option<MouseButton> { match n { 0 => Some(MouseButton::Unknown), 1 => Some(MouseButton::Left), 2 => Some(MouseButton::Right), 3 => Some(MouseButton::Middle), 4 => Some(MouseButton::X1), 5 => Some(MouseButton::X2), 6 => Some(MouseButton::Button6), 7 => Some(MouseButton::Button7), 8 => Some(MouseButton::Button8), _ => Some(MouseButton::Unknown), } } #[inline(always)] fn from_i64(n: i64) -> Option<MouseButton> { FromPrimitive::from_u64(n as u64) } #[inline(always)]<|fim▁hole|> impl ToPrimitive for MouseButton { fn to_u64(&self) -> Option<u64> { match self { &MouseButton::Unknown => Some(0), &MouseButton::Left => Some(1), &MouseButton::Right => Some(2), &MouseButton::Middle => Some(3), &MouseButton::X1 => Some(4), &MouseButton::X2 => Some(5), &MouseButton::Button6 => Some(6), &MouseButton::Button7 => Some(7), &MouseButton::Button8 => Some(8), } } #[inline(always)] fn to_i64(&self) -> Option<i64> { self.to_u64().map(|x| x as i64) } #[inline(always)] fn to_isize(&self) -> Option<isize> { self.to_u64().map(|x| x as isize) } } #[cfg(test)] mod tests { use super::*; #[test] fn test_mouse_button_primitives() { use num::{ FromPrimitive, ToPrimitive }; for i in 0u64..9 { let button: MouseButton = FromPrimitive::from_u64(i).unwrap(); let j = ToPrimitive::to_u64(&button).unwrap(); assert_eq!(i, j); } } }<|fim▁end|>
fn from_isize(n: isize) -> Option<MouseButton> { FromPrimitive::from_u64(n as u64) } }
<|file_name|>writer.py<|end_file_name|><|fim▁begin|># Copyright 2022 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 <|fim▁hole|>from sis_provisioner.csv import get_filepath from sis_provisioner.csv.user_writer import make_import_user_csv_files from sis_provisioner.util.log import log_exception from sis_provisioner.util.settings import get_csv_file_path_prefix logger = logging.getLogger(__name__) class CsvMaker: """ For the given loader, create the corresponsing csv files. """ def __init__(self,): """ @param: loader an account_managers.loader subclass object """ self.file_wrote = False self.filepath = get_filepath(path_prefix=get_csv_file_path_prefix()) def fetch_users(self): return get_all_uw_accounts() def load_files(self): try: number_users_wrote = make_import_user_csv_files( self.fetch_users(), self.filepath) logger.info("Total {0:d} users wrote into {1}\n".format( number_users_wrote, self.filepath)) return number_users_wrote except Exception: log_exception( logger, "Failed to make user csv file in {0}".format(self.filepath), traceback.format_exc())<|fim▁end|>
import logging import traceback from sis_provisioner.dao.uw_account import get_all_uw_accounts
<|file_name|>ManipulationSettingsContainer.ts<|end_file_name|><|fim▁begin|>import { EditorSettings, errors, NewLineKind, SettingsContainer } from "@ts-morph/common"; import { QuoteKind, UserPreferences } from "../compiler"; import { fillDefaultEditorSettings, newLineKindToString } from "../utils"; /** Kinds of indentation */ export enum IndentationText { /** Two spaces */ TwoSpaces = " ", /** Four spaces */ FourSpaces = " ", /** Eight spaces */ EightSpaces = " ", /** Tab */ Tab = "\t", } /** * Manipulation settings. */ export interface ManipulationSettings extends SupportedFormatCodeSettingsOnly { /** Indentation text */ indentationText: IndentationText; /** New line kind */ newLineKind: NewLineKind; /** Quote type used for string literals. */ quoteKind: QuoteKind; /** * Whether to enable renaming shorthand property assignments, binding elements, * and import & export specifiers without changing behaviour. * @remarks Defaults to true. * This setting is only available when using TypeScript 3.4+. */ usePrefixAndSuffixTextForRename: boolean; /** Whether to use trailing commas when inserting or removing nodes. */ useTrailingCommas: boolean; } <|fim▁hole|> */ export interface SupportedFormatCodeSettings extends SupportedFormatCodeSettingsOnly, EditorSettings { } /** * FormatCodeSettings that are currently supported in the library. */ export interface SupportedFormatCodeSettingsOnly { /** * Whether to insert a space after opening and before closing non-empty braces. * * ex. `import { Item } from "./Item";` or `import {Item} from "./Item";` * @remarks Defaults to true. */ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: boolean; } /** * Holds the manipulation settings. */ export class ManipulationSettingsContainer extends SettingsContainer<ManipulationSettings> { private _editorSettings: EditorSettings | undefined; private _formatCodeSettings: SupportedFormatCodeSettings | undefined; private _userPreferences: UserPreferences | undefined; constructor() { super({ indentationText: IndentationText.FourSpaces, newLineKind: NewLineKind.LineFeed, quoteKind: QuoteKind.Double, insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, usePrefixAndSuffixTextForRename: false, useTrailingCommas: false, }); } /** * Gets the editor settings based on the current manipulation settings. */ getEditorSettings(): Readonly<EditorSettings> { if (this._editorSettings == null) { this._editorSettings = {}; fillDefaultEditorSettings(this._editorSettings, this); } return { ...this._editorSettings }; } /** * Gets the format code settings. */ getFormatCodeSettings(): Readonly<SupportedFormatCodeSettings> { if (this._formatCodeSettings == null) { this._formatCodeSettings = { ...this.getEditorSettings(), insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: this._settings.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces, }; } return { ...this._formatCodeSettings }; } /** * Gets the user preferences. */ getUserPreferences(): Readonly<UserPreferences> { if (this._userPreferences == null) { this._userPreferences = { quotePreference: this.getQuoteKind() === QuoteKind.Double ? "double" : "single", providePrefixAndSuffixTextForRename: this.getUsePrefixAndSuffixTextForRename(), }; } return { ...this._userPreferences }; } /** * Gets the quote kind used for string literals. */ getQuoteKind() { return this._settings.quoteKind; } /** * Gets the new line kind. */ getNewLineKind() { return this._settings.newLineKind; } /** * Gets the new line kind as a string. */ getNewLineKindAsString() { return newLineKindToString(this.getNewLineKind()); } /** * Gets the indentation text. */ getIndentationText() { return this._settings.indentationText; } /** * Gets whether to use prefix and suffix text when renaming. */ getUsePrefixAndSuffixTextForRename() { return this._settings.usePrefixAndSuffixTextForRename; } /** * Gets whether trailing commas should be used. */ getUseTrailingCommas() { return this._settings.useTrailingCommas; } /** * Sets one or all of the settings. * @param settings - Settings to set. */ set(settings: Partial<ManipulationSettings>) { super.set(settings); this._editorSettings = undefined; this._formatCodeSettings = undefined; this._userPreferences = undefined; } /** * @internal * Gets the indent size as represented in spaces. */ _getIndentSizeInSpaces() { const indentationText = this.getIndentationText(); switch (indentationText) { case IndentationText.EightSpaces: return 8; case IndentationText.FourSpaces: return 4; case IndentationText.TwoSpaces: return 2; case IndentationText.Tab: return 4; // most common default: return errors.throwNotImplementedForNeverValueError(indentationText); } } }<|fim▁end|>
/** * FormatCodeSettings that are currently supported in the library.
<|file_name|>info.js<|end_file_name|><|fim▁begin|><|fim▁hole|> size = require('gulp-size'); // output size in console gulp.task('info', function() { // You can pass as many relative urls as you want return gulp.src(config.destPaths.root + '/*/**') .pipe(size()) });<|fim▁end|>
'use strict'; var config = require('../config'), gulp = require('gulp'),
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from .waveform_utils import omega, k, VTEMFun, TriangleFun, SineFun from .current_utils import (<|fim▁hole|><|fim▁end|>
getStraightLineCurrentIntegral, getSourceTermLineCurrentPolygon, segmented_line_current_source_term, )
<|file_name|>eq.rs<|end_file_name|><|fim▁begin|>#![feature(core)] extern crate core; #[cfg(test)] mod tests { // pub trait FixedSizeArray<T> { // /// Converts the array to immutable slice // fn as_slice(&self) -> &[T]; // /// Converts the array to mutable slice // fn as_mut_slice(&mut self) -> &mut [T]; // } // macro_rules! array_impls { // ($($N:expr)+) => { // $( // #[unstable(feature = "core")] // impl<T> FixedSizeArray<T> for [T; $N] { // #[inline] // fn as_slice(&self) -> &[T] { // &self[..] // } // #[inline] // fn as_mut_slice(&mut self) -> &mut [T] { // &mut self[..] // } // } // // #[unstable(feature = "array_as_ref", // reason = "should ideally be implemented for all fixed-sized arrays")] // impl<T> AsRef<[T]> for [T; $N] { // #[inline] // fn as_ref(&self) -> &[T] { // &self[..] // } // } // // #[unstable(feature = "array_as_ref", // reason = "should ideally be implemented for all fixed-sized arrays")] // impl<T> AsMut<[T]> for [T; $N] { // #[inline] // fn as_mut(&mut self) -> &mut [T] { // &mut self[..] // } // } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<T:Copy> Clone for [T; $N] { // fn clone(&self) -> [T; $N] { // *self // }<|fim▁hole|> // #[stable(feature = "rust1", since = "1.0.0")] // impl<T: Hash> Hash for [T; $N] { // fn hash<H: hash::Hasher>(&self, state: &mut H) { // Hash::hash(&self[..], state) // } // } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<T: fmt::Debug> fmt::Debug for [T; $N] { // fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // fmt::Debug::fmt(&&self[..], f) // } // } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<'a, T> IntoIterator for &'a [T; $N] { // type Item = &'a T; // type IntoIter = Iter<'a, T>; // // fn into_iter(self) -> Iter<'a, T> { // self.iter() // } // } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<'a, T> IntoIterator for &'a mut [T; $N] { // type Item = &'a mut T; // type IntoIter = IterMut<'a, T>; // // fn into_iter(self) -> IterMut<'a, T> { // self.iter_mut() // } // } // // // NOTE: some less important impls are omitted to reduce code bloat // __impl_slice_eq1! { [A; $N], [B; $N] } // __impl_slice_eq2! { [A; $N], [B] } // __impl_slice_eq2! { [A; $N], &'b [B] } // __impl_slice_eq2! { [A; $N], &'b mut [B] } // // __impl_slice_eq2! { [A; $N], &'b [B; $N] } // // __impl_slice_eq2! { [A; $N], &'b mut [B; $N] } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<T:Eq> Eq for [T; $N] { } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<T:PartialOrd> PartialOrd for [T; $N] { // #[inline] // fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> { // PartialOrd::partial_cmp(&&self[..], &&other[..]) // } // #[inline] // fn lt(&self, other: &[T; $N]) -> bool { // PartialOrd::lt(&&self[..], &&other[..]) // } // #[inline] // fn le(&self, other: &[T; $N]) -> bool { // PartialOrd::le(&&self[..], &&other[..]) // } // #[inline] // fn ge(&self, other: &[T; $N]) -> bool { // PartialOrd::ge(&&self[..], &&other[..]) // } // #[inline] // fn gt(&self, other: &[T; $N]) -> bool { // PartialOrd::gt(&&self[..], &&other[..]) // } // } // // #[stable(feature = "rust1", since = "1.0.0")] // impl<T:Ord> Ord for [T; $N] { // #[inline] // fn cmp(&self, other: &[T; $N]) -> Ordering { // Ord::cmp(&&self[..], &&other[..]) // } // } // )+ // } // } // array_impls! { // 0 1 2 3 4 5 6 7 8 9 // 10 11 12 13 14 15 16 17 18 19 // 20 21 22 23 24 25 26 27 28 29 // 30 31 32 // } type T = i32; type A = T; type B = T; #[test] fn eq_test1() { let array_a: [A; 28] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; let array_b: [B; 28] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; assert_eq!(array_a.eq(&array_b), true); assert_eq!(array_a == array_b, true); } #[test] fn eq_test2() { let array_a: [A; 28] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; let slice_b: &[B] = &[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; assert_eq!(array_a.eq(&*slice_b), true); assert_eq!(array_a == *slice_b, true); assert_eq!((*slice_b).eq(&array_a), true); assert_eq!((*slice_b) == array_a, true); } #[test] fn eq_test3() { let array_a: [A; 28] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; let slice_b: &[B] = &[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; assert_eq!(array_a.eq(&slice_b), true); assert_eq!(array_a == slice_b, true); assert_eq!(slice_b.eq(&array_a), true); assert_eq!(slice_b == array_a, true); } #[test] fn eq_test4() { let array_a: [A; 28] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; let slice_b: &mut [B] = &mut [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ]; assert_eq!(array_a.eq(&slice_b), true); assert_eq!(array_a == slice_b, true); assert_eq!(slice_b.eq(&array_a), true); assert_eq!(slice_b == array_a, true); } }<|fim▁end|>
// } //
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Optcoretech documentation build configuration file, created by # sphinx-quickstart on Mon Sep 1 14:23:01 2014. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Optcoretech' copyright = u'2014, Sheesh Mohsin' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.1' # The full version, including alpha/beta/rc tags. release = '0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'Optcoretechdoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [<|fim▁hole|> u'Sheesh Mohsin', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'optcoretech', u'Optcoretech Documentation', [u'Sheesh Mohsin'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'Optcoretech', u'Optcoretech Documentation', u'Sheesh Mohsin', 'Optcoretech', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote'<|fim▁end|>
('index', 'Optcoretech.tex', u'Optcoretech Documentation',
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub type fflags_t = u32; pub type clock_t = i32; pub type ino_t = u32; pub type lwpid_t = i32; pub type nlink_t = u16; pub type blksize_t = u32; pub type clockid_t = ::c_int; pub type sem_t = _sem; pub type fsblkcnt_t = ::uint64_t; pub type fsfilcnt_t = ::uint64_t; pub type idtype_t = ::c_uint; s! { pub struct utmpx { pub ut_type: ::c_short, pub ut_tv: ::timeval, pub ut_id: [::c_char; 8], pub ut_pid: ::pid_t, pub ut_user: [::c_char; 32], pub ut_line: [::c_char; 16], pub ut_host: [::c_char; 128], pub __ut_spare: [::c_char; 64], } pub struct aiocb { pub aio_fildes: ::c_int, pub aio_offset: ::off_t, pub aio_buf: *mut ::c_void, pub aio_nbytes: ::size_t, __unused1: [::c_int; 2], __unused2: *mut ::c_void, pub aio_lio_opcode: ::c_int, pub aio_reqprio: ::c_int, // unused 3 through 5 are the __aiocb_private structure<|fim▁hole|> __unused3: ::c_long, __unused4: ::c_long, __unused5: *mut ::c_void, pub aio_sigevent: sigevent } pub struct dirent { pub d_fileno: u32, pub d_reclen: u16, pub d_type: u8, pub d_namlen: u8, pub d_name: [::c_char; 256], } pub struct jail { pub version: u32, pub path: *mut ::c_char, pub hostname: *mut ::c_char, pub jailname: *mut ::c_char, pub ip4s: ::c_uint, pub ip6s: ::c_uint, pub ip4: *mut ::in_addr, pub ip6: *mut ::in6_addr, } pub struct sigevent { pub sigev_notify: ::c_int, pub sigev_signo: ::c_int, pub sigev_value: ::sigval, //The rest of the structure is actually a union. We expose only //sigev_notify_thread_id because it's the most useful union member. pub sigev_notify_thread_id: ::lwpid_t, #[cfg(target_pointer_width = "64")] __unused1: ::c_int, __unused2: [::c_long; 7] } pub struct statvfs { pub f_bavail: ::fsblkcnt_t, pub f_bfree: ::fsblkcnt_t, pub f_blocks: ::fsblkcnt_t, pub f_favail: ::fsfilcnt_t, pub f_ffree: ::fsfilcnt_t, pub f_files: ::fsfilcnt_t, pub f_bsize: ::c_ulong, pub f_flag: ::c_ulong, pub f_frsize: ::c_ulong, pub f_fsid: ::c_ulong, pub f_namemax: ::c_ulong, } // internal structure has changed over time pub struct _sem { data: [u32; 4], } } pub const SIGEV_THREAD_ID: ::c_int = 4; pub const RAND_MAX: ::c_int = 0x7fff_fffd; pub const PTHREAD_STACK_MIN: ::size_t = 2048; pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4; pub const SIGSTKSZ: ::size_t = 34816; pub const SF_NODISKIO: ::c_int = 0x00000001; pub const SF_MNOWAIT: ::c_int = 0x00000002; pub const SF_SYNC: ::c_int = 0x00000004; pub const O_CLOEXEC: ::c_int = 0x00100000; pub const F_GETLK: ::c_int = 11; pub const F_SETLK: ::c_int = 12; pub const F_SETLKW: ::c_int = 13; pub const ELAST: ::c_int = 96; pub const RLIMIT_NPTS: ::c_int = 11; pub const RLIMIT_SWAP: ::c_int = 12; pub const RLIM_NLIMITS: ::rlim_t = 13; pub const Q_GETQUOTA: ::c_int = 0x700; pub const Q_SETQUOTA: ::c_int = 0x800; pub const POSIX_FADV_NORMAL: ::c_int = 0; pub const POSIX_FADV_RANDOM: ::c_int = 1; pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; pub const POSIX_FADV_WILLNEED: ::c_int = 3; pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; pub const EVFILT_READ: ::int16_t = -1; pub const EVFILT_WRITE: ::int16_t = -2; pub const EVFILT_AIO: ::int16_t = -3; pub const EVFILT_VNODE: ::int16_t = -4; pub const EVFILT_PROC: ::int16_t = -5; pub const EVFILT_SIGNAL: ::int16_t = -6; pub const EVFILT_TIMER: ::int16_t = -7; pub const EVFILT_FS: ::int16_t = -9; pub const EVFILT_LIO: ::int16_t = -10; pub const EVFILT_USER: ::int16_t = -11; pub const EV_ADD: ::uint16_t = 0x1; pub const EV_DELETE: ::uint16_t = 0x2; pub const EV_ENABLE: ::uint16_t = 0x4; pub const EV_DISABLE: ::uint16_t = 0x8; pub const EV_ONESHOT: ::uint16_t = 0x10; pub const EV_CLEAR: ::uint16_t = 0x20; pub const EV_RECEIPT: ::uint16_t = 0x40; pub const EV_DISPATCH: ::uint16_t = 0x80; pub const EV_DROP: ::uint16_t = 0x1000; pub const EV_FLAG1: ::uint16_t = 0x2000; pub const EV_ERROR: ::uint16_t = 0x4000; pub const EV_EOF: ::uint16_t = 0x8000; pub const EV_SYSFLAGS: ::uint16_t = 0xf000; pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; pub const NOTE_FFNOP: ::uint32_t = 0x00000000; pub const NOTE_FFAND: ::uint32_t = 0x40000000; pub const NOTE_FFOR: ::uint32_t = 0x80000000; pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; pub const NOTE_LOWAT: ::uint32_t = 0x00000001; pub const NOTE_DELETE: ::uint32_t = 0x00000001; pub const NOTE_WRITE: ::uint32_t = 0x00000002; pub const NOTE_EXTEND: ::uint32_t = 0x00000004; pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; pub const NOTE_LINK: ::uint32_t = 0x00000010; pub const NOTE_RENAME: ::uint32_t = 0x00000020; pub const NOTE_REVOKE: ::uint32_t = 0x00000040; pub const NOTE_EXIT: ::uint32_t = 0x80000000; pub const NOTE_FORK: ::uint32_t = 0x40000000; pub const NOTE_EXEC: ::uint32_t = 0x20000000; pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; pub const NOTE_TRACK: ::uint32_t = 0x00000001; pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; pub const NOTE_CHILD: ::uint32_t = 0x00000004; pub const NOTE_SECONDS: ::uint32_t = 0x00000001; pub const NOTE_MSECONDS: ::uint32_t = 0x00000002; pub const NOTE_USECONDS: ::uint32_t = 0x00000004; pub const NOTE_NSECONDS: ::uint32_t = 0x00000008; pub const MADV_PROTECT: ::c_int = 10; pub const RUSAGE_THREAD: ::c_int = 1; pub const CLOCK_REALTIME: clockid_t = 0; pub const CLOCK_VIRTUAL: clockid_t = 1; pub const CLOCK_PROF: clockid_t = 2; pub const CLOCK_MONOTONIC: clockid_t = 4; pub const CLOCK_UPTIME: clockid_t = 5; pub const CLOCK_UPTIME_PRECISE: clockid_t = 7; pub const CLOCK_UPTIME_FAST: clockid_t = 8; pub const CLOCK_REALTIME_PRECISE: clockid_t = 9; pub const CLOCK_REALTIME_FAST: clockid_t = 10; pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11; pub const CLOCK_MONOTONIC_FAST: clockid_t = 12; pub const CLOCK_SECOND: clockid_t = 13; pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14; pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15; pub const CTL_UNSPEC: ::c_int = 0; pub const CTL_KERN: ::c_int = 1; pub const CTL_VM: ::c_int = 2; pub const CTL_VFS: ::c_int = 3; pub const CTL_NET: ::c_int = 4; pub const CTL_DEBUG: ::c_int = 5; pub const CTL_HW: ::c_int = 6; pub const CTL_MACHDEP: ::c_int = 7; pub const CTL_USER: ::c_int = 8; pub const CTL_P1003_1B: ::c_int = 9; pub const KERN_OSTYPE: ::c_int = 1; pub const KERN_OSRELEASE: ::c_int = 2; pub const KERN_OSREV: ::c_int = 3; pub const KERN_VERSION: ::c_int = 4; pub const KERN_MAXVNODES: ::c_int = 5; pub const KERN_MAXPROC: ::c_int = 6; pub const KERN_MAXFILES: ::c_int = 7; pub const KERN_ARGMAX: ::c_int = 8; pub const KERN_SECURELVL: ::c_int = 9; pub const KERN_HOSTNAME: ::c_int = 10; pub const KERN_HOSTID: ::c_int = 11; pub const KERN_CLOCKRATE: ::c_int = 12; pub const KERN_VNODE: ::c_int = 13; pub const KERN_PROC: ::c_int = 14; pub const KERN_FILE: ::c_int = 15; pub const KERN_PROF: ::c_int = 16; pub const KERN_POSIX1: ::c_int = 17; pub const KERN_NGROUPS: ::c_int = 18; pub const KERN_JOB_CONTROL: ::c_int = 19; pub const KERN_SAVED_IDS: ::c_int = 20; pub const KERN_BOOTTIME: ::c_int = 21; pub const KERN_NISDOMAINNAME: ::c_int = 22; pub const KERN_UPDATEINTERVAL: ::c_int = 23; pub const KERN_OSRELDATE: ::c_int = 24; pub const KERN_NTP_PLL: ::c_int = 25; pub const KERN_BOOTFILE: ::c_int = 26; pub const KERN_MAXFILESPERPROC: ::c_int = 27; pub const KERN_MAXPROCPERUID: ::c_int = 28; pub const KERN_DUMPDEV: ::c_int = 29; pub const KERN_IPC: ::c_int = 30; pub const KERN_DUMMY: ::c_int = 31; pub const KERN_PS_STRINGS: ::c_int = 32; pub const KERN_USRSTACK: ::c_int = 33; pub const KERN_LOGSIGEXIT: ::c_int = 34; pub const KERN_IOV_MAX: ::c_int = 35; pub const KERN_HOSTUUID: ::c_int = 36; pub const KERN_ARND: ::c_int = 37; pub const KERN_PROC_ALL: ::c_int = 0; pub const KERN_PROC_PID: ::c_int = 1; pub const KERN_PROC_PGRP: ::c_int = 2; pub const KERN_PROC_SESSION: ::c_int = 3; pub const KERN_PROC_TTY: ::c_int = 4; pub const KERN_PROC_UID: ::c_int = 5; pub const KERN_PROC_RUID: ::c_int = 6; pub const KERN_PROC_ARGS: ::c_int = 7; pub const KERN_PROC_PROC: ::c_int = 8; pub const KERN_PROC_SV_NAME: ::c_int = 9; pub const KERN_PROC_RGID: ::c_int = 10; pub const KERN_PROC_GID: ::c_int = 11; pub const KERN_PROC_PATHNAME: ::c_int = 12; pub const KERN_PROC_OVMMAP: ::c_int = 13; pub const KERN_PROC_OFILEDESC: ::c_int = 14; pub const KERN_PROC_KSTACK: ::c_int = 15; pub const KERN_PROC_INC_THREAD: ::c_int = 0x10; pub const KERN_PROC_VMMAP: ::c_int = 32; pub const KERN_PROC_FILEDESC: ::c_int = 33; pub const KERN_PROC_GROUPS: ::c_int = 34; pub const KERN_PROC_ENV: ::c_int = 35; pub const KERN_PROC_AUXV: ::c_int = 36; pub const KERN_PROC_RLIMIT: ::c_int = 37; pub const KERN_PROC_PS_STRINGS: ::c_int = 38; pub const KERN_PROC_UMASK: ::c_int = 39; pub const KERN_PROC_OSREL: ::c_int = 40; pub const KERN_PROC_SIGTRAMP: ::c_int = 41; pub const KIPC_MAXSOCKBUF: ::c_int = 1; pub const KIPC_SOCKBUF_WASTE: ::c_int = 2; pub const KIPC_SOMAXCONN: ::c_int = 3; pub const KIPC_MAX_LINKHDR: ::c_int = 4; pub const KIPC_MAX_PROTOHDR: ::c_int = 5; pub const KIPC_MAX_HDR: ::c_int = 6; pub const KIPC_MAX_DATALEN: ::c_int = 7; pub const HW_MACHINE: ::c_int = 1; pub const HW_MODEL: ::c_int = 2; pub const HW_NCPU: ::c_int = 3; pub const HW_BYTEORDER: ::c_int = 4; pub const HW_PHYSMEM: ::c_int = 5; pub const HW_USERMEM: ::c_int = 6; pub const HW_PAGESIZE: ::c_int = 7; pub const HW_DISKNAMES: ::c_int = 8; pub const HW_DISKSTATS: ::c_int = 9; pub const HW_FLOATINGPT: ::c_int = 10; pub const HW_MACHINE_ARCH: ::c_int = 11; pub const HW_REALMEM: ::c_int = 12; pub const USER_CS_PATH: ::c_int = 1; pub const USER_BC_BASE_MAX: ::c_int = 2; pub const USER_BC_DIM_MAX: ::c_int = 3; pub const USER_BC_SCALE_MAX: ::c_int = 4; pub const USER_BC_STRING_MAX: ::c_int = 5; pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6; pub const USER_EXPR_NEST_MAX: ::c_int = 7; pub const USER_LINE_MAX: ::c_int = 8; pub const USER_RE_DUP_MAX: ::c_int = 9; pub const USER_POSIX2_VERSION: ::c_int = 10; pub const USER_POSIX2_C_BIND: ::c_int = 11; pub const USER_POSIX2_C_DEV: ::c_int = 12; pub const USER_POSIX2_CHAR_TERM: ::c_int = 13; pub const USER_POSIX2_FORT_DEV: ::c_int = 14; pub const USER_POSIX2_FORT_RUN: ::c_int = 15; pub const USER_POSIX2_LOCALEDEF: ::c_int = 16; pub const USER_POSIX2_SW_DEV: ::c_int = 17; pub const USER_POSIX2_UPE: ::c_int = 18; pub const USER_STREAM_MAX: ::c_int = 19; pub const USER_TZNAME_MAX: ::c_int = 20; pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1; pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2; pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3; pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4; pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5; pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6; pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7; pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8; pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9; pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10; pub const CTL_P1003_1B_FSYNC: ::c_int = 11; pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12; pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13; pub const CTL_P1003_1B_TIMERS: ::c_int = 14; pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15; pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16; pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17; pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18; pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19; pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20; pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21; pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22; pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23; pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24; pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25; pub const TIOCGPTN: ::c_uint = 0x4004740f; pub const TIOCPTMASTER: ::c_uint = 0x2000741c; pub const TIOCSIG: ::c_uint = 0x2004745f; pub const TIOCM_DCD: ::c_int = 0x40; pub const H4DISC: ::c_int = 0x7; pub const JAIL_API_VERSION: u32 = 2; pub const JAIL_CREATE: ::c_int = 0x01; pub const JAIL_UPDATE: ::c_int = 0x02; pub const JAIL_ATTACH: ::c_int = 0x04; pub const JAIL_DYING: ::c_int = 0x08; pub const JAIL_SET_MASK: ::c_int = 0x0f; pub const JAIL_GET_MASK: ::c_int = 0x08; pub const JAIL_SYS_DISABLE: ::c_int = 0; pub const JAIL_SYS_NEW: ::c_int = 1; pub const JAIL_SYS_INHERIT: ::c_int = 2; // The *_MAXID constants never should've been used outside of the // FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID, // they were all removed in svn r262489. They remain here for backwards // compatibility only, and are scheduled to be removed in libc 1.0.0. #[doc(hidden)] pub const CTL_MAXID: ::c_int = 10; #[doc(hidden)] pub const KERN_MAXID: ::c_int = 38; #[doc(hidden)] pub const HW_MAXID: ::c_int = 13; #[doc(hidden)] pub const USER_MAXID: ::c_int = 21; #[doc(hidden)] pub const CTL_P1003_1B_MAXID: ::c_int = 26; pub const MSG_PEEK: ::c_int = 0x2; pub const MSG_NOSIGNAL: ::c_int = 0x20000; pub const EMPTY: ::c_short = 0; pub const BOOT_TIME: ::c_short = 1; pub const OLD_TIME: ::c_short = 2; pub const NEW_TIME: ::c_short = 3; pub const USER_PROCESS: ::c_short = 4; pub const INIT_PROCESS: ::c_short = 5; pub const LOGIN_PROCESS: ::c_short = 6; pub const DEAD_PROCESS: ::c_short = 7; pub const SHUTDOWN_TIME: ::c_short = 8; pub const LC_COLLATE_MASK: ::c_int = (1 << 0); pub const LC_CTYPE_MASK: ::c_int = (1 << 1); pub const LC_MESSAGES_MASK: ::c_int = (1 << 2); pub const LC_MONETARY_MASK: ::c_int = (1 << 3); pub const LC_NUMERIC_MASK: ::c_int = (1 << 4); pub const LC_TIME_MASK: ::c_int = (1 << 5); pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK; pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED pub const WCONTINUED: ::c_int = 4; pub const WNOWAIT: ::c_int = 8; pub const WEXITED: ::c_int = 16; pub const WTRAPPED: ::c_int = 32; // FreeBSD defines a great many more of these, we only expose the // standardized ones. pub const P_PID: idtype_t = 0; pub const P_PGID: idtype_t = 2; pub const P_ALL: idtype_t = 7; extern { pub fn __error() -> *mut ::c_int; pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int; pub fn jail(jail: *mut ::jail) -> ::c_int; pub fn jail_attach(jid: ::c_int) -> ::c_int; pub fn jail_remove(jid: ::c_int) -> ::c_int; pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int; pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int; pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int; pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int; pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int; pub fn getutxuser(user: *const ::c_char) -> *mut utmpx; pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int; pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::ssize_t; pub fn freelocale(loc: ::locale_t) -> ::c_int; pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; } cfg_if! { if #[cfg(target_arch = "x86")] { mod x86; pub use self::x86::*; } else if #[cfg(target_arch = "x86_64")] { mod x86_64; pub use self::x86_64::*; } else if #[cfg(target_arch = "aarch64")] { mod aarch64; pub use self::aarch64::*; } else { // Unknown target_arch } }<|fim▁end|>
<|file_name|>code.java<|end_file_name|><|fim▁begin|>class LinkedList { public static void main(String[] a) { System.out.println(new LL().Start()); } } class Element { int Age; int Salary; boolean Married; public boolean Init(int v_Age, int v_Salary, boolean v_Married) { Age = v_Age; Salary = v_Salary; Married = v_Married; return true; } public int GetAge() { return Age; } public int GetSalary() { return Salary; } public boolean GetMarried() { return Married; } public boolean Equal(Element other) { boolean ret_val; int aux01; int aux02; int nt; ret_val = true; aux01 = other.GetAge(); if (!(this.Compare(aux01, Age))) ret_val = false; else { aux02 = other.GetSalary(); if (!(this.Compare(aux02, Salary))) ret_val = false; else if (Married) if (!(other.GetMarried())) ret_val = false; else nt = 0; else if (other.GetMarried()) ret_val = false; else nt = 0; } return ret_val; } public boolean Compare(int num1, int num2) { boolean retval; int aux02; retval = false; aux02 = num2 + 1; if (num1 < num2) retval = false; else if (!(num1 < aux02)) retval = false; else retval = true; return retval; } } class List { Element elem; List next; boolean end; public boolean Init() { end = true; return true; } public boolean InitNew(Element v_elem, List v_next, boolean v_end) { end = v_end; elem = v_elem; next = v_next; return true; } public List Insert(Element new_elem) { boolean ret_val; List aux03; List aux02; aux03 = this; aux02 = new List(); ret_val = aux02.InitNew(new_elem, aux03, false); return aux02; } <|fim▁hole|> next = v_next; return true; } public List Delete(Element e) { List my_head; boolean ret_val; boolean aux05; List aux01; List prev; boolean var_end; Element var_elem; int aux04; int nt; my_head = this; ret_val = false; aux04 = 0 - 1; aux01 = this; prev = this; var_end = end; var_elem = elem; while (!(var_end) && !(ret_val)) { if (e.Equal(var_elem)) { ret_val = true; if (aux04 < 0) { my_head = aux01.GetNext(); } else { System.out.println(0 - 555); aux05 = prev.SetNext(aux01.GetNext()); System.out.println(0 - 555); } } else nt = 0; if (!(ret_val)) { prev = aux01; aux01 = aux01.GetNext(); var_end = aux01.GetEnd(); var_elem = aux01.GetElem(); aux04 = 1; } else nt = 0; } return my_head; } public int Search(Element e) { int int_ret_val; List aux01; Element var_elem; boolean var_end; int nt; int_ret_val = 0; aux01 = this; var_end = end; var_elem = elem; while (!(var_end)) { if (e.Equal(var_elem)) { int_ret_val = 1; } else nt = 0; aux01 = aux01.GetNext(); var_end = aux01.GetEnd(); var_elem = aux01.GetElem(); } return int_ret_val; } public boolean GetEnd() { return end; } public Element GetElem() { return elem; } public List GetNext() { return next; } public boolean Print() { List aux01; boolean var_end; Element var_elem; aux01 = this; var_end = end; var_elem = elem; while (!(var_end)) { System.out.println(var_elem.GetAge()); aux01 = aux01.GetNext(); var_end = aux01.GetEnd(); var_elem = aux01.GetElem(); } return true; } } class LL { public int Start() { List head; List last_elem; boolean aux01; Element el01; Element el02; Element el03; last_elem = new List(); aux01 = last_elem.Init(); head = last_elem; aux01 = head.Init(); aux01 = head.Print(); el01 = new Element(); aux01 = el01.Init(25, 37000, false); head = head.Insert(el01); aux01 = head.Print(); System.out.println(10000000); el01 = new Element(); aux01 = el01.Init(39, 42000, true); el02 = el01; head = head.Insert(el01); aux01 = head.Print(); System.out.println(10000000); el01 = new Element(); aux01 = el01.Init(22, 34000, false); head = head.Insert(el01); aux01 = head.Print(); el03 = new Element(); aux01 = el03.Init(27, 34000, false); System.out.println(head.Search(el02)); System.out.println(head.Search(el03)); System.out.println(10000000); el01 = new Element(); aux01 = el01.Init(28, 35000, false); head = head.Insert(el01); aux01 = head.Print(); System.out.println(2220000); head = head.Delete(el02); aux01 = head.Print(); System.out.println(33300000); head = head.Delete(el01); aux01 = head.Print(); System.out.println(44440000); return 0; } }<|fim▁end|>
public boolean SetNext(List v_next) {
<|file_name|>linedlg.py<|end_file_name|><|fim▁begin|># Sketch - A Python-based interactive drawing program # Copyright (C) 1997, 1998, 1999, 2001, 2002 by Bernhard Herzog # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # A dialog for specifying line properties # import operator from X import LineDoubleDash from Sketch.const import JoinMiter, JoinBevel, JoinRound,\ CapButt, CapProjecting, CapRound from Sketch.Lib import util from Sketch import _, Trafo, SimpleGC, SolidPattern, EmptyPattern, \ StandardDashes, StandardArrows, StandardColors from Tkinter import Frame, Label, IntVar, LEFT, X, E, W, GROOVE from tkext import ColorButton, UpdatedCheckbutton, MyOptionMenu2 from sketchdlg import StylePropertyPanel from lengthvar import create_length_entry import skpixmaps pixmaps = skpixmaps.PixmapTk def create_bitmap_image(tk, name, bitmap): data = util.xbm_string(bitmap) tk.call(('image', 'create', 'bitmap', name, '-foreground', 'black', '-data', data, '-maskdata', data)) return name _thickness = 3 _width = 90 def draw_dash_bitmap(gc, dashes): scale = float(_thickness) if dashes: dashes = map(operator.mul, dashes, [scale] * len(dashes)) dashes = map(int, map(round, dashes)) for idx in range(len(dashes)): length = dashes[idx] if length <= 0: dashes[idx] = 1 elif length > 255: dashes[idx] = 255 else: dashes = [_width + 10, 1] gc.SetDashes(dashes) gc.DrawLine(0, _thickness / 2, _width, _thickness / 2) def create_dash_images(tk, tkwin, dashes): bitmap = tkwin.CreatePixmap(_width, _thickness, 1) gc = bitmap.CreateGC(foreground = 1, background = 0, line_style = LineDoubleDash, line_width = _thickness) images = [] for dash in dashes: draw_dash_bitmap(gc, dash) image = create_bitmap_image(tk, 'dash_' + `len(images)`, bitmap) images.append((image, dash)) return gc, bitmap, images _arrow_width = 31 _arrow_height = 25 _mirror = Trafo(-1, 0, 0, 1, 0, 0) def draw_arrow_bitmap(gc, arrow, which = 2): gc.gc.foreground = 0 gc.gc.FillRectangle(0, 0, _arrow_width + 1, _arrow_height + 1) gc.gc.foreground = 1 y = _arrow_height / 2 if which == 1: gc.PushTrafo() gc.Concat(_mirror) gc.DrawLineXY(0, 0, -1000, 0) if arrow is not None: arrow.Draw(gc) if which == 1: gc.PopTrafo() def create_arrow_images(tk, tkwin, arrows): arrows = [None] + arrows bitmap = tkwin.CreatePixmap(_arrow_width, _arrow_height, 1) gc = SimpleGC() gc.init_gc(bitmap, foreground = 1, background = 0, line_width = 3) gc.Translate(_arrow_width / 2, _arrow_height / 2) gc.Scale(2) images1 = [] for arrow in arrows: draw_arrow_bitmap(gc, arrow, 1) image = create_bitmap_image(tk, 'arrow1_' + `len(images1)`, bitmap) images1.append((image, arrow)) images2 = [] for arrow in arrows: draw_arrow_bitmap(gc, arrow, 2) image = create_bitmap_image(tk, 'arrow2_' + `len(images2)`, bitmap) images2.append((image, arrow)) return gc, bitmap, images1, images2 class LinePanel(StylePropertyPanel): title = _("Line Style") def __init__(self, master, main_window, doc): StylePropertyPanel.__init__(self, master, main_window, doc, name = 'linedlg') def build_dlg(self): top = self.top button_frame = self.create_std_buttons(top) button_frame.grid(row = 5, columnspan = 2, sticky = 'ew') color_frame = Frame(top, relief = GROOVE, bd = 2) color_frame.grid(row = 0, columnspan = 2, sticky = 'ew') label = Label(color_frame, text = _("Color")) label.pack(side = LEFT, expand = 1, anchor = E) self.color_but = ColorButton(color_frame, width = 3, height = 1, command = self.set_line_color) self.color_but.SetColor(StandardColors.black) self.color_but.pack(side = LEFT, expand = 1, anchor = W) self.var_color_none = IntVar(top) check = UpdatedCheckbutton(color_frame, text = _("None"), variable = self.var_color_none, command = self.do_apply) check.pack(side = LEFT, expand = 1) width_frame = Frame(top, relief = GROOVE, bd = 2) width_frame.grid(row = 1, columnspan = 2, sticky = 'ew') label = Label(width_frame, text = _("Width")) label.pack(side = LEFT, expand = 1, anchor = E) self.var_width = create_length_entry(top, width_frame, self.set_line_width, scroll_pad = 0) tkwin = self.main_window.canvas.tkwin gc, bitmap, dashlist = create_dash_images(self.top.tk, tkwin, StandardDashes()) self.opt_dash = MyOptionMenu2(top, dashlist, command = self.set_dash, entry_type = 'image', highlightthickness = 0) self.opt_dash.grid(row = 2, columnspan = 2, sticky = 'ew', ipady = 2) self.dash_gc = gc<|fim▁hole|> gc, bitmap, arrow1, arrow2 = create_arrow_images(self.top.tk, tkwin, StandardArrows()) self.opt_arrow1 = MyOptionMenu2(top, arrow1, command = self.set_arrow, args = 1, entry_type = 'image', highlightthickness = 0) self.opt_arrow1.grid(row = 3, column = 0, sticky = 'ew', ipady = 2) self.opt_arrow2 = MyOptionMenu2(top, arrow2, command = self.set_arrow, args = 2, entry_type = 'image', highlightthickness = 0) self.opt_arrow2.grid(row = 3, column = 1, sticky = 'ew', ipady = 2) self.arrow_gc = gc self.arrow_bitmap = bitmap self.opt_join = MyOptionMenu2(top, [(pixmaps.JoinMiter, JoinMiter), (pixmaps.JoinRound, JoinRound), (pixmaps.JoinBevel, JoinBevel)], command = self.set_line_join, entry_type = 'bitmap', highlightthickness = 0) self.opt_join.grid(row = 4, column = 0, sticky = 'ew') self.opt_cap = MyOptionMenu2(top, [(pixmaps.CapButt, CapButt), (pixmaps.CapRound, CapRound), (pixmaps.CapProjecting, CapProjecting)], command = self.set_line_cap, entry_type = 'bitmap', highlightthickness = 0) self.opt_cap.grid(row = 4, column = 1, sticky = 'ew') self.opt_cap.SetValue(None) def close_dlg(self): StylePropertyPanel.close_dlg(self) self.var_width = None def init_from_style(self, style): if style.HasLine(): self.var_color_none.set(0) self.opt_join.SetValue(style.line_join) self.opt_cap.SetValue(style.line_cap) self.color_but.SetColor(style.line_pattern.Color()) self.var_width.set(style.line_width) self.init_dash(style) self.init_arrow(style) else: self.var_color_none.set(1) def init_from_doc(self): self.Update() def Update(self): if self.document.HasSelection(): properties = self.document.CurrentProperties() self.init_from_style(properties) def do_apply(self): kw = {} if not self.var_color_none.get(): color = self.color_but.Color() kw["line_pattern"] = SolidPattern(color) kw["line_width"] = self.var_width.get() kw["line_join"] = self.opt_join.GetValue() kw["line_cap"] = self.opt_cap.GetValue() kw["line_dashes"] = self.opt_dash.GetValue() kw["line_arrow1"] = self.opt_arrow1.GetValue() kw["line_arrow2"] = self.opt_arrow2.GetValue() else: kw["line_pattern"] = EmptyPattern self.set_properties(_("Set Outline"), 'line', kw) def set_line_join(self, *args): self.document.SetProperties(line_join = self.opt_join.GetValue(), if_type_present = 1) def set_line_cap(self, *args): self.document.SetProperties(line_cap = self.opt_cap.GetValue(), if_type_present = 1) def set_line_color(self): self.document.SetLineColor(self.color_but.Color()) def set_line_width(self, *rest): self.document.SetProperties(line_width = self.var_width.get(), if_type_present = 1) def set_dash(self, *args): self.document.SetProperties(line_dashes = self.opt_dash.GetValue(), if_type_present = 1) def init_dash(self, style): dashes = style.line_dashes draw_dash_bitmap(self.dash_gc, dashes) dash_image = create_bitmap_image(self.top.tk, 'dash_image', self.dash_bitmap) self.opt_dash.SetValue(dashes, dash_image) def set_arrow(self, arrow, which): if which == 1: self.document.SetProperties(line_arrow1 = arrow, if_type_present = 1) else: self.document.SetProperties(line_arrow2 = arrow, if_type_present = 1) def init_arrow(self, style): arrow = style.line_arrow1 draw_arrow_bitmap(self.arrow_gc, arrow, 1) arrow_image = create_bitmap_image(self.top.tk, 'arrow1_image', self.arrow_bitmap) self.opt_arrow1.SetValue(arrow, arrow_image) arrow = style.line_arrow2 draw_arrow_bitmap(self.arrow_gc, arrow, 2) arrow_image = create_bitmap_image(self.top.tk, 'arrow2_image', self.arrow_bitmap) self.opt_arrow2.SetValue(arrow, arrow_image) def update_from_object_cb(self, obj): if obj is not None: self.init_from_style(obj.Properties())<|fim▁end|>
self.dash_bitmap = bitmap
<|file_name|>cov.py<|end_file_name|><|fim▁begin|>from bacpypes.apdu import SubscribeCOVRequest, SimpleAckPDU, RejectPDU, AbortPDU from bacpypes.iocb import IOCB from bacpypes.core import deferred from bacpypes.pdu import Address from bacpypes.object import get_object_class, get_datatype from bacpypes.constructeddata import Array from bacpypes.primitivedata import Tag, ObjectIdentifier, Unsigned from BAC0.core.io.Read import cast_datatype_from_tag """ using cov, we build a "context" which is turned into a subscription being sent to the destination. Once the IOCB is over, the callback attached to it will execute (subscription_acknowledged) and we'll get the answer """ class SubscriptionContext: next_proc_id = 1 <|fim▁hole|> def __init__(self, address, objectID, confirmed=None, lifetime=None, callback=None): self.address = address self.subscriberProcessIdentifier = SubscriptionContext.next_proc_id SubscriptionContext.next_proc_id += 1 self.monitoredObjectIdentifier = objectID self.issueConfirmedNotifications = confirmed self.lifetime = lifetime self.callback = callback def cov_notification(self, apdu): # make a rash assumption that the property value is going to be # a single application encoded tag source = apdu.pduSource object_changed = apdu.monitoredObjectIdentifier elements = { "source": source, "object_changed": object_changed, "properties": {}, } for element in apdu.listOfValues: prop_id = element.propertyIdentifier datatype = get_datatype(object_changed[0], prop_id) value = element.value if not datatype: value = cast_datatype_from_tag( element.value, object_changed[0], prop_id ) else: # special case for array parts, others are managed by cast_out if issubclass(datatype, Array) and ( element.propertyArrayIndex is not None ): if element.propertyArrayIndex == 0: value = element.value.cast_out(Unsigned) else: value = element.value.cast_out(datatype.subtype) else: value = element.value.cast_out(datatype) elements["properties"][prop_id] = value return elements class CoV: """ Mixin to support COV registration """ def send_cov_subscription(self, request): self._log.debug("Request : {}".format(request)) iocb = IOCB(request) self._log.debug("IOCB : {}".format(iocb)) iocb.add_callback(self.subscription_acknowledged) # pass to the BACnet stack deferred(self.this_application.request_io, iocb) def subscription_acknowledged(self, iocb): if iocb.ioResponse: self._log.info("Subscription success") if iocb.ioError: self._log.error("Subscription failed. {}".format(iocb.ioError)) def cov(self, address, objectID, confirmed=True, lifetime=0, callback=None): address = Address(address) context = self._build_cov_context( address, objectID, confirmed=confirmed, lifetime=lifetime, callback=callback ) request = self._build_cov_request(context) self.send_cov_subscription(request) def cancel_cov(self, address, objectID, callback=None): address = Address(address) context = self._build_cov_context( address, objectID, confirmed=None, lifetime=None, callback=callback ) request = self._build_cov_request(context) self.send_cov_subscription(request) def _build_cov_context( self, address, objectID, confirmed=True, lifetime=None, callback=None ): context = SubscriptionContext( address=address, objectID=objectID, confirmed=confirmed, lifetime=lifetime, callback=callback, ) self.subscription_contexts[context.subscriberProcessIdentifier] = context if "context_callback" not in self.subscription_contexts.keys(): self.subscription_contexts["context_callback"] = self.context_callback return context def _build_cov_request(self, context): request = SubscribeCOVRequest( subscriberProcessIdentifier=context.subscriberProcessIdentifier, monitoredObjectIdentifier=context.monitoredObjectIdentifier, ) request.pduDestination = context.address # optional parameters if context.issueConfirmedNotifications is not None: request.issueConfirmedNotifications = context.issueConfirmedNotifications if context.lifetime is not None: request.lifetime = context.lifetime return request # def context_callback(self, elements, callback=None): def context_callback(self, elements): self._log.info("Received COV Notification for {}".format(elements)) # if callback: # callback() for device in self.registered_devices: if str(device.properties.address) == str(elements["source"]): device[elements["object_changed"]].cov_registered = True for prop, value in elements["properties"].items(): if prop == "presentValue": device[elements["object_changed"]]._trend(value) else: device[elements["object_changed"]].properties.bacnet_properties[ prop ] = value break<|fim▁end|>
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># definitions which are not being deprecated from wagtail.admin.forms from .models import ( # NOQA DIRECT_FORM_FIELD_OVERRIDES, FORM_FIELD_OVERRIDES, WagtailAdminModelForm,<|fim▁hole|><|fim▁end|>
WagtailAdminModelFormMetaclass, formfield_for_dbfield) from .pages import WagtailAdminPageForm # NOQA
<|file_name|>api.py<|end_file_name|><|fim▁begin|># Natural Language Toolkit: Stemmer Interface # # Copyright (C) 2001-2008 University of Pennsylvania # Author: Trevor Cohn <[email protected]> # Edward Loper <[email protected]> # Steven Bird <[email protected]> # URL: <http://nltk.sf.net> # For license information, see LICENSE.TXT class StemmerI(object): """ A processing interface for removing morphological affixes from words. This process is known as X{stemming}. """ def stem(self, token): """ Strip affixes from the token and return the stem.<|fim▁hole|> @type token: L{string} """ raise NotImplementedError()<|fim▁end|>
@param token: The token that should be stemmed.
<|file_name|>test_parse_covtype_2.py<|end_file_name|><|fim▁begin|>import unittest, sys sys.path.extend(['.','..','../..','py']) import h2o2 as h2o import h2o_cmd, h2o_import as h2i, h2o_browse as h2b from h2o_test import find_file, dump_json, verboseprint expectedZeros = [0, 4914, 656, 24603, 38665, 124, 13, 5, 1338, 51, 320216, 551128, 327648, 544044, 577981, 573487, 576189, 568616, 579415, 574437, 580907, 580833, 579865, 548378, 568602, 551041, 563581, 580413, 581009, 578167, 577590, 579113, 576991, 571753, 580174, 547639, 523260, 559734, 580538, 578423, 579926, 580066, 465765, 550842, 555346, 528493, 535858, 579401, 579121, 580893, 580714, 565439, 567206, 572262, 0] def assertEqualMsg(a, b): assert a == b, "%s %s" % (a, b) def parseKeyIndexedCheck(frames_result, multiplyExpected): # get the name of the frame? print "" frame = frames_result['frames'][0] rows = frame['rows'] columns = frame['columns'] for i,c in enumerate(columns): label = c['label'] stype = c['type'] missing = c['missing'] zeros = c['zeros'] domain = c['domain'] print "column: %s label: %s type: %s missing: %s zeros: %s domain: %s" %\ (i,label,stype,missing,zeros,domain) # files are concats of covtype. so multiply expected assertEqualMsg(zeros, expectedZeros[i] * multiplyExpected) assertEqualMsg(label,"C%s" % (i+1)) assertEqualMsg(stype,"int") assertEqualMsg(missing, 0) assertEqualMsg(domain, None) class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): h2o.init() @classmethod def tearDownClass(cls): h2o.tear_down_cloud() def test_parse_covtype_2(self): tryList = [ ('covtype.data', 1, 30), ('covtype20x.data', 20, 120), ] for (csvFilename, multiplyExpected, timeoutSecs) in tryList: # import_result = a_node.import_files(path=find_file("smalldata/logreg/prostate.csv")) importFolderPath = "standard" hex_key = 'covtype.hex' csvPathname = importFolderPath + "/" + csvFilename parseResult = h2i.import_parse(bucket='home-0xdiag-datasets', path=csvPathname, schema='local', timeoutSecs=timeoutSecs, hex_key=hex_key, chunk_size=4194304*2, doSummary=False) pA = h2o_cmd.ParseObj(parseResult) iA = h2o_cmd.InspectObj(pA.parse_key) print iA.missingList, iA.labelList, iA.numRows, iA.numCols for i in range(1): print "Summary on column", i co = h2o_cmd.runSummary(key=hex_key, column=i) <|fim▁hole|> a_node = h2o.nodes[0] frames_result = a_node.frames(key=k, row_count=5) # print "frames_result from the first parseResult key", dump_json(frames_result) parseKeyIndexedCheck(frames_result, multiplyExpected) if __name__ == '__main__': h2o.unit_main()<|fim▁end|>
k = parseResult['frames'][0]['key']['name'] # print "parseResult:", dump_json(parseResult)
<|file_name|>utf8_chars.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern mod extra; use std::str; pub fn main() { // Chars of 1, 2, 3, and 4 bytes let chs: ~[char] = ~['e', 'é', '€', '\U00010000']; let s: ~str = str::from_chars(chs); let schs: ~[char] = s.chars().collect(); assert!(s.len() == 10u); assert!(s.char_len() == 4u); assert!(schs.len() == 4u); assert!(str::from_chars(schs) == s); assert!(s.char_at(0u) == 'e'); assert!(s.char_at(1u) == 'é'); assert!((str::is_utf8(s.as_bytes()))); // invalid prefix assert!((!str::is_utf8([0x80_u8]))); // invalid 2 byte prefix assert!((!str::is_utf8([0xc0_u8]))); assert!((!str::is_utf8([0xc0_u8, 0x10_u8]))); // invalid 3 byte prefix assert!((!str::is_utf8([0xe0_u8]))); assert!((!str::is_utf8([0xe0_u8, 0x10_u8]))); assert!((!str::is_utf8([0xe0_u8, 0xff_u8, 0x10_u8]))); // invalid 4 byte prefix assert!((!str::is_utf8([0xf0_u8]))); assert!((!str::is_utf8([0xf0_u8, 0x10_u8]))); assert!((!str::is_utf8([0xf0_u8, 0xff_u8, 0x10_u8]))); assert!((!str::is_utf8([0xf0_u8, 0xff_u8, 0xff_u8, 0x10_u8]))); let mut stack = ~"a×c€"; assert_eq!(stack.pop_char(), '€'); assert_eq!(stack.pop_char(), 'c'); stack.push_char('u'); assert!(stack == ~"a×u"); assert_eq!(stack.shift_char(), 'a'); assert_eq!(stack.shift_char(), '×');<|fim▁hole|> assert!(stack == ~"ßu"); }<|fim▁end|>
stack.unshift_char('ß');
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 Pierre Talbot (IRCAM) // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. pub mod ntcc;<|fim▁hole|><|fim▁end|>
pub mod type_name; pub mod calc;
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># pylint: disable=too-many-lines """ Component to interface with cameras. For more details about this component, please refer to the documentation at https://home-assistant.io/components/camera/ """ import asyncio import logging from aiohttp import web from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.config_validation import PLATFORM_SCHEMA # noqa from homeassistant.components.http import HomeAssistantView DOMAIN = 'camera' DEPENDENCIES = ['http'] SCAN_INTERVAL = 30 ENTITY_ID_FORMAT = DOMAIN + '.{}' STATE_RECORDING = 'recording' STATE_STREAMING = 'streaming' STATE_IDLE = 'idle' ENTITY_IMAGE_URL = '/api/camera_proxy/{0}?token={1}' <|fim▁hole|>def async_setup(hass, config): """Setup the camera component.""" component = EntityComponent( logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL) hass.http.register_view(CameraImageView(hass, component.entities)) hass.http.register_view(CameraMjpegStream(hass, component.entities)) yield from component.async_setup(config) return True class Camera(Entity): """The base class for camera entities.""" def __init__(self): """Initialize a camera.""" self.is_streaming = False @property def access_token(self): """Access token for this camera.""" return str(id(self)) @property def should_poll(self): """No need to poll cameras.""" return False @property def entity_picture(self): """Return a link to the camera feed as entity picture.""" return ENTITY_IMAGE_URL.format(self.entity_id, self.access_token) @property def is_recording(self): """Return true if the device is recording.""" return False @property def brand(self): """Camera brand.""" return None @property def model(self): """Camera model.""" return None def camera_image(self): """Return bytes of camera image.""" raise NotImplementedError() @asyncio.coroutine def async_camera_image(self): """Return bytes of camera image. This method must be run in the event loop. """ image = yield from self.hass.loop.run_in_executor( None, self.camera_image) return image @asyncio.coroutine def handle_async_mjpeg_stream(self, request): """Generate an HTTP MJPEG stream from camera images. This method must be run in the event loop. """ response = web.StreamResponse() response.content_type = ('multipart/x-mixed-replace; ' 'boundary=--jpegboundary') yield from response.prepare(request) def write(img_bytes): """Write image to stream.""" response.write(bytes( '--jpegboundary\r\n' 'Content-Type: image/jpeg\r\n' 'Content-Length: {}\r\n\r\n'.format( len(img_bytes)), 'utf-8') + img_bytes + b'\r\n') last_image = None try: while True: img_bytes = yield from self.async_camera_image() if not img_bytes: break if img_bytes is not None and img_bytes != last_image: write(img_bytes) # Chrome seems to always ignore first picture, # print it twice. if last_image is None: write(img_bytes) last_image = img_bytes yield from response.drain() yield from asyncio.sleep(.5) finally: yield from response.write_eof() @property def state(self): """Camera state.""" if self.is_recording: return STATE_RECORDING elif self.is_streaming: return STATE_STREAMING else: return STATE_IDLE @property def state_attributes(self): """Camera state attributes.""" attr = { 'access_token': self.access_token, } if self.model: attr['model_name'] = self.model if self.brand: attr['brand'] = self.brand return attr class CameraView(HomeAssistantView): """Base CameraView.""" requires_auth = False def __init__(self, hass, entities): """Initialize a basic camera view.""" super().__init__(hass) self.entities = entities @asyncio.coroutine def get(self, request, entity_id): """Start a get request.""" camera = self.entities.get(entity_id) if camera is None: return web.Response(status=404) authenticated = (request.authenticated or request.GET.get('token') == camera.access_token) if not authenticated: return web.Response(status=401) response = yield from self.handle(request, camera) return response @asyncio.coroutine def handle(self, request, camera): """Hanlde the camera request.""" raise NotImplementedError() class CameraImageView(CameraView): """Camera view to serve an image.""" url = "/api/camera_proxy/{entity_id}" name = "api:camera:image" @asyncio.coroutine def handle(self, request, camera): """Serve camera image.""" image = yield from camera.async_camera_image() if image is None: return web.Response(status=500) return web.Response(body=image) class CameraMjpegStream(CameraView): """Camera View to serve an MJPEG stream.""" url = "/api/camera_proxy_stream/{entity_id}" name = "api:camera:stream" @asyncio.coroutine def handle(self, request, camera): """Serve camera image.""" yield from camera.handle_async_mjpeg_stream(request)<|fim▁end|>
@asyncio.coroutine
<|file_name|>gtest_env_var_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Verifies that Google Test correctly parses environment variables.""" __author__ = '[email protected] (Zhanyong Wan)' import os import gtest_test_utils IS_WINDOWS = os.name == 'nt' IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_') def AssertEq(expected, actual): if expected != actual: print 'Expected: %s' % (expected,) print ' Actual: %s' % (actual,) raise AssertionError def SetEnvVar(env_var, value): """Sets the env variable to 'value'; unsets it when 'value' is None.""" if value is not None: os.environ[env_var] = value elif env_var in os.environ: del os.environ[env_var] def GetFlag(flag): """Runs gtest_env_var_test_ and returns its output.""" args = [COMMAND] if flag is not None: args += [flag] return gtest_test_utils.Subprocess(args).output<|fim▁hole|> """Verifies that the given flag is affected by the corresponding env var.""" env_var = 'GTEST_' + flag.upper() SetEnvVar(env_var, test_val) AssertEq(test_val, GetFlag(flag)) SetEnvVar(env_var, None) AssertEq(default_val, GetFlag(flag)) class GTestEnvVarTest(gtest_test_utils.TestCase): def testEnvVarAffectsFlag(self): """Tests that environment variable should affect the corresponding flag.""" TestFlag('break_on_failure', '1', '0') TestFlag('color', 'yes', 'auto') TestFlag('filter', 'FooTest.Bar', '*') TestFlag('output', 'tmp/foo.xml', '') TestFlag('print_time', '0', '1') TestFlag('repeat', '999', '1') TestFlag('throw_on_failure', '1', '0') TestFlag('death_test_style', 'threadsafe', 'fast') if IS_WINDOWS: TestFlag('catch_exceptions', '1', '0') if IS_LINUX: TestFlag('death_test_use_fork', '1', '0') TestFlag('stack_trace_depth', '0', '100') if __name__ == '__main__': gtest_test_utils.Main()<|fim▁end|>
def TestFlag(flag, test_val, default_val):
<|file_name|>count.spec.js<|end_file_name|><|fim▁begin|>import * as lamb from "../.."; import { nonFunctions, wannabeEmptyArrays } from "../../__tests__/commons"; describe("count / countBy", function () { var getCity = lamb.getKey("city"); var persons = [ { name: "Jane", surname: "Doe", age: 12, city: "New York" }, { name: "John", surname: "Doe", age: 40, city: "New York" }, { name: "Mario", surname: "Rossi", age: 18, city: "Rome" }, { name: "Paolo", surname: "Bianchi", age: 15 } ]; var personsCityCount = { "New York": 2, Rome: 1, undefined: 1 }; <|fim▁hole|> var splitByAgeGroup = function (person, idx, list) { expect(list).toBe(persons); expect(persons[idx]).toBe(person); return person.age > 20 ? "over20" : "under20"; }; it("should count the occurences of the key generated by the provided iteratee", function () { expect(lamb.count(persons, getCity)).toEqual(personsCityCount); expect(lamb.countBy(getCity)(persons)).toEqual(personsCityCount); expect(lamb.count(persons, splitByAgeGroup)).toEqual(personsAgeGroupCount); expect(lamb.countBy(splitByAgeGroup)(persons)).toEqual(personsAgeGroupCount); }); it("should work with array-like objects", function () { var result = { h: 1, e: 1, l: 3, o: 2, " ": 1, w: 1, r: 1, d: 1 }; expect(lamb.count("hello world", lamb.identity)).toEqual(result); expect(lamb.countBy(lamb.identity)("hello world")).toEqual(result); }); it("should throw an exception if the iteratee isn't a function", function () { nonFunctions.forEach(function (value) { expect(function () { lamb.count(persons, value); }).toThrow(); expect(function () { lamb.countBy(value)(persons); }).toThrow(); }); expect(function () { lamb.count(persons); }).toThrow(); expect(function () { lamb.countBy()(persons); }).toThrow(); }); it("should consider deleted or unassigned indexes in sparse arrays as `undefined` values", function () { var arr = [1, , 3, void 0, 5]; // eslint-disable-line no-sparse-arrays var result = { false: 3, true: 2 }; expect(lamb.count(arr, lamb.isUndefined)).toEqual(result); expect(lamb.countBy(lamb.isUndefined)(arr)).toEqual(result); }); it("should throw an exception if called without the data argument", function () { expect(lamb.count).toThrow(); expect(lamb.countBy(lamb.identity)).toThrow(); }); it("should throw an exception if supplied with `null` or `undefined`", function () { expect(function () { lamb.count(null, lamb.identity); }).toThrow(); expect(function () { lamb.count(void 0, lamb.identity); }).toThrow(); expect(function () { lamb.countBy(lamb.identity)(null); }).toThrow(); expect(function () { lamb.countBy(lamb.identity)(void 0); }).toThrow(); }); it("should treat every other value as an empty array and return an empty object", function () { wannabeEmptyArrays.forEach(function (value) { expect(lamb.countBy(lamb.identity)(value)).toEqual({}); expect(lamb.count(value, lamb.identity)).toEqual({}); }); }); });<|fim▁end|>
var personsAgeGroupCount = { under20: 3, over20: 1 };
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>/* * Panopticon - A libre disassembler * Copyright (C) 2017 Panopticon authors * * 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 * (at your option) 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/>. */ use std::env; use std::fs::File; use std::io::Write; use std::path::Path; #[derive(Clone,Copy,Debug)] enum Argument { Literal, LiteralWidth, NoOffset, Offset, Constant, Undefined, } impl Argument { pub fn match_expr(&self, pos: &'static str) -> String { match self { &Argument::Literal => format!("( ${}:expr )", pos), &Argument::LiteralWidth => format!("( ${}:expr ) : ${}_w:tt", pos, pos), &Argument::NoOffset => format!("${}:tt : ${}_w:tt", pos, pos), &Argument::Offset => format!("${}:tt : ${}_w:tt / ${}_o:tt", pos, pos, pos), &Argument::Constant => format!("[ ${}:tt ] : ${}_w:tt", pos, pos), &Argument::Undefined => "?".to_string(), } } pub fn arg_expr(&self, pos: &'static str) -> String { match self { &Argument::Literal => format!("( ${} )", pos), &Argument::LiteralWidth => format!("( ${} ) : ${}_w", pos, pos), &Argument::NoOffset => format!("${} : ${}_w", pos, pos), &Argument::Offset => format!("${} : ${}_w / ${}_o", pos, pos, pos), &Argument::Constant => format!("[ ${} ] : ${}_w", pos, pos), &Argument::Undefined => "?".to_string(), } } } const BOILERPLATE: &'static str = " let ret: $crate::result::Result<Vec<$crate::il::Statement>> = match stmt[0].sanity_check() { Ok(()) => { let mut tail: $crate::result::Result<Vec<$crate::il::Statement>> = { rreil!( $($cdr)*) }; match tail { Ok(ref mut other) => { stmt.extend(other.drain(..)); Ok(stmt) } Err(e) => Err(e), } } Err(e) => Err(e).into(), }; ret "; const LVALUES: &'static [Argument] = &[ Argument::Literal, Argument::LiteralWidth, Argument::NoOffset, Argument::Undefined, ]; const RVALUES: &'static [Argument] = &[ Argument::Literal, Argument::LiteralWidth, Argument::NoOffset, Argument::Offset, Argument::Constant, Argument::Undefined, ]; fn write_binary_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_binop { " ) .unwrap(); for a in LVALUES.iter() { for b in RVALUES.iter() { for c in RVALUES.iter() { f.write_fmt( format_args!( " // {:?} := {:?}, {:?} ( $op:ident # {}, {} , {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::$op(rreil_rvalue!({}),rreil_rvalue!({})), assignee: rreil_lvalue!({}) }}]; {} }}}}; ", a, b, c, a.match_expr("a"), b.match_expr("b"), c.match_expr("c"), b.arg_expr("b"), c.arg_expr("c"), a.arg_expr("a"), BOILERPLATE ) ) .unwrap(); } } } f.write_all( b"} " ) .unwrap(); } fn write_unary_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_unop { " ) .unwrap(); for a in LVALUES.iter() { for b in RVALUES.iter() { f.write_fmt( format_args!( " // {:?} := {:?} ( $op:ident # {}, {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::$op(rreil_rvalue!({})), assignee: rreil_lvalue!({}) }}]; {} }}}}; ", a, b, a.match_expr("a"), b.match_expr("b"), b.arg_expr("b"), a.arg_expr("a"), BOILERPLATE ) ) .unwrap(); } } f.write_all( b"} " ) .unwrap(); } fn write_memory_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_memop { " ) .unwrap(); for a in LVALUES.iter() { for b in RVALUES.iter() { // Little Endian Load f.write_fmt(format_args!(" // {:?} := {:?} ( Load # $bank:ident # le # $sz:tt # {} , {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::Load( ::std::borrow::Cow::Borrowed(stringify!($bank)), $crate::Endianess::Little, rreil_imm!($sz),<|fim▁hole|> }}]; {} }}}}; ",a,b, a.match_expr("a"),b.match_expr("b"), b.arg_expr("b"),a.arg_expr("a"), BOILERPLATE)).unwrap(); // Big Endian Load f.write_fmt(format_args!(" // {:?} := {:?} ( Load # $bank:ident # be # $sz:tt # {} , {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::Load( ::std::borrow::Cow::Borrowed(stringify!($bank)), $crate::Endianess::Big, rreil_imm!($sz), rreil_rvalue!({}) ), assignee: rreil_lvalue!({}) }}]; {} }}}}; ",a,b, a.match_expr("a"),b.match_expr("b"), b.arg_expr("b"),a.arg_expr("a"), BOILERPLATE)).unwrap(); } } for val in RVALUES.iter() { for ptr in RVALUES.iter() { // Little Endian Store f.write_fmt(format_args!(" // *({:?}) := {:?} ( Store # $bank:ident # le # $sz:tt # {} , {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::Store( ::std::borrow::Cow::Borrowed(stringify!($bank)), $crate::Endianess::Little, rreil_imm!($sz), rreil_rvalue!({}), rreil_rvalue!({}) ), assignee: Lvalue::Undefined }}]; {} }}}}; ",ptr,val, val.match_expr("val"),ptr.match_expr("ptr"), ptr.arg_expr("ptr"),val.arg_expr("val"), BOILERPLATE)).unwrap(); // Big Endian Store f.write_fmt(format_args!(" // {:?} := {:?} ( Store # $bank:ident # be # $sz:tt # {} , {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::Store( ::std::borrow::Cow::Borrowed(stringify!($bank)), $crate::Endianess::Big, rreil_imm!($sz), rreil_rvalue!({}), rreil_rvalue!({}) ), assignee: Lvalue::Undefined }}]; {} }}}}; ",ptr,val, val.match_expr("val"),ptr.match_expr("ptr"), ptr.arg_expr("ptr"),val.arg_expr("val"), BOILERPLATE)).unwrap(); } } f.write_all( b"} " ) .unwrap(); } fn write_extraction_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_extop { " ) .unwrap(); for a in LVALUES.iter() { for b in RVALUES.iter() { f.write_fmt( format_args!( " // {:?} := {:?} ( $op:ident # $sz:tt # {}, {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::$op(rreil_imm!($sz),rreil_rvalue!({})), assignee: rreil_lvalue!({}) }}]; {} }}}}; ", a, b, a.match_expr("a"), b.match_expr("b"), b.arg_expr("b"), a.arg_expr("a"), BOILERPLATE ) ) .unwrap(); } } f.write_all( b"} " ) .unwrap(); } fn write_selection_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_selop { " ) .unwrap(); for a in LVALUES.iter() { for b in RVALUES.iter() { f.write_fmt( format_args!( " // {:?} := {:?} ( $op:ident # $sz:tt # {}, {} ; $($cdr:tt)*) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::$op(rreil_imm!($sz),rreil_rvalue!({}),rreil_rvalue!({})), assignee: rreil_lvalue!({}) }}]; {} }}}}; ", a, b, a.match_expr("a"), b.match_expr("b"), a.arg_expr("a"), b.arg_expr("b"), a.arg_expr("a"), BOILERPLATE ) ) .unwrap(); } } f.write_all( b"} " ) .unwrap(); } fn write_call_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_callop { " ) .unwrap(); for a in RVALUES.iter() { f.write_fmt( format_args!( " // call {:?} ( {} ; $($cdr:tt)* ) => {{{{ let mut stmt = vec![$crate::Statement{{ op: $crate::Operation::Call(rreil_rvalue!({})), assignee: $crate::Lvalue::Undefined }}]; {} }}}}; ", a, a.match_expr("a"), a.arg_expr("a"), BOILERPLATE ) ) .unwrap(); } f.write_all( b"} " ) .unwrap(); } fn write_ret_operations(f: &mut File) { f.write_all( b" #[macro_export] macro_rules! rreil_retop { " ) .unwrap(); for a in RVALUES.iter() { f.write_fmt( format_args!( " // ret {:?} ( {} ; $($cdr:tt)* ) => {{{{ let mut stmt = vec![$crate::Statement::Return{{ stack_effect: rreil_rvalue!({}), }}]; {} }}}}; ", a, a.match_expr("a"), a.arg_expr("a"), BOILERPLATE ) ) .unwrap(); } f.write_all( b"} " ) .unwrap(); } fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("rreil.rs"); let mut f = File::create(&dest_path).unwrap(); write_binary_operations(&mut f); write_unary_operations(&mut f); write_memory_operations(&mut f); write_call_operations(&mut f); write_ret_operations(&mut f); write_extraction_operations(&mut f); write_selection_operations(&mut f); }<|fim▁end|>
rreil_rvalue!({}) ), assignee: rreil_lvalue!({})
<|file_name|>coveragemodels.py<|end_file_name|><|fim▁begin|>from mongoengine import Document, StringField, DateTimeField, ListField, DateTimeField, IntField, BooleanField, \ ObjectIdField, FloatField class Covelement(Document): instructionsCov = IntField() instructionsMis = IntField() branchesCov = IntField() branchesMis = IntField() lineCov = IntField() lineMis = IntField() complexityCov = IntField() complexityMis = IntField() methodCov = IntField() methodMis = IntField() class Covproject(Covelement):<|fim▁hole|>class Covpackage(Covelement): classCov = IntField() classMis = IntField() name = StringField(required=True) class CovClass(Covelement): classCov = IntField() classMis = IntField() name = StringField(required=True) class CovMethod(Covelement): name = StringField(required=True) desc = StringField(required=True) line = IntField() class CovSourcefile(Covelement): classCov = IntField() classMis = IntField() name = StringField(required=True) class CovLine(): number = IntField() branchesCov = IntField() branchesMis = IntField() instructionsCov = IntField() instructionsMis = IntField()<|fim▁end|>
classCov = IntField() classMis = IntField()
<|file_name|>nest_test.py<|end_file_name|><|fim▁begin|># Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for utilities working with arbitrarily nested structures.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import time from absl.testing import parameterized import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.platform import test from tensorflow.python.util import nest from tensorflow.python.util.compat import collections_abc try: import attr # pylint:disable=g-import-not-at-top except ImportError: attr = None class _CustomMapping(collections_abc.Mapping): def __init__(self, *args, **kwargs): self._wrapped = dict(*args, **kwargs) def __getitem__(self, key): return self._wrapped[key] def __iter__(self): return iter(self._wrapped) def __len__(self): return len(self._wrapped) class _CustomSequenceThatRaisesException(collections.Sequence): def __len__(self): return 1 def __getitem__(self, item): raise ValueError("Cannot get item: %s" % item) class NestTest(parameterized.TestCase, test.TestCase): PointXY = collections.namedtuple("Point", ["x", "y"]) # pylint: disable=invalid-name unsafe_map_pattern = ("nest cannot guarantee that it is safe to map one to " "the other.") bad_pack_pattern = ("Attempted to pack value:\n .+\ninto a sequence, but " "found incompatible type `<(type|class) 'str'>` instead.") if attr: class BadAttr(object): """Class that has a non-iterable __attrs_attrs__.""" __attrs_attrs__ = None @attr.s class SampleAttr(object): field1 = attr.ib() field2 = attr.ib() @attr.s class UnsortedSampleAttr(object): field3 = attr.ib() field1 = attr.ib() field2 = attr.ib() @test_util.assert_no_new_pyobjects_executing_eagerly def testAttrsFlattenAndPack(self): if attr is None: self.skipTest("attr module is unavailable.") field_values = [1, 2] sample_attr = NestTest.SampleAttr(*field_values) self.assertFalse(nest._is_attrs(field_values)) self.assertTrue(nest._is_attrs(sample_attr)) flat = nest.flatten(sample_attr) self.assertEqual(field_values, flat) restructured_from_flat = nest.pack_sequence_as(sample_attr, flat) self.assertIsInstance(restructured_from_flat, NestTest.SampleAttr) self.assertEqual(restructured_from_flat, sample_attr) # Check that flatten fails if attributes are not iterable with self.assertRaisesRegexp(TypeError, "object is not iterable"): flat = nest.flatten(NestTest.BadAttr()) @parameterized.parameters( {"values": [1, 2, 3]}, {"values": [{"B": 10, "A": 20}, [1, 2], 3]}, {"values": [(1, 2), [3, 4], 5]}, {"values": [PointXY(1, 2), 3, 4]}, ) @test_util.assert_no_new_pyobjects_executing_eagerly def testAttrsMapStructure(self, values): if attr is None: self.skipTest("attr module is unavailable.") structure = NestTest.UnsortedSampleAttr(*values) new_structure = nest.map_structure(lambda x: x, structure) self.assertEqual(structure, new_structure) @test_util.assert_no_new_pyobjects_executing_eagerly def testFlattenAndPack(self): structure = ((3, 4), 5, (6, 7, (9, 10), 8)) flat = ["a", "b", "c", "d", "e", "f", "g", "h"] self.assertEqual(nest.flatten(structure), [3, 4, 5, 6, 7, 9, 10, 8]) self.assertEqual( nest.pack_sequence_as(structure, flat), (("a", "b"), "c", ("d", "e", ("f", "g"), "h"))) structure = (NestTest.PointXY(x=4, y=2), ((NestTest.PointXY(x=1, y=0),),)) flat = [4, 2, 1, 0] self.assertEqual(nest.flatten(structure), flat) restructured_from_flat = nest.pack_sequence_as(structure, flat) self.assertEqual(restructured_from_flat, structure) self.assertEqual(restructured_from_flat[0].x, 4) self.assertEqual(restructured_from_flat[0].y, 2) self.assertEqual(restructured_from_flat[1][0][0].x, 1) self.assertEqual(restructured_from_flat[1][0][0].y, 0) self.assertEqual([5], nest.flatten(5)) self.assertEqual([np.array([5])], nest.flatten(np.array([5]))) self.assertEqual("a", nest.pack_sequence_as(5, ["a"])) self.assertEqual( np.array([5]), nest.pack_sequence_as("scalar", [np.array([5])])) with self.assertRaisesRegexp( ValueError, self.unsafe_map_pattern): nest.pack_sequence_as("scalar", [4, 5]) with self.assertRaisesRegexp(TypeError, self.bad_pack_pattern): nest.pack_sequence_as([4, 5], "bad_sequence") with self.assertRaises(ValueError): nest.pack_sequence_as([5, 6, [7, 8]], ["a", "b", "c"]) @parameterized.parameters({"mapping_type": collections.OrderedDict}, {"mapping_type": _CustomMapping}) @test_util.assert_no_new_pyobjects_executing_eagerly def testFlattenDictOrder(self, mapping_type): """`flatten` orders dicts by key, including OrderedDicts.""" ordered = mapping_type([("d", 3), ("b", 1), ("a", 0), ("c", 2)]) plain = {"d": 3, "b": 1, "a": 0, "c": 2} ordered_flat = nest.flatten(ordered) plain_flat = nest.flatten(plain) self.assertEqual([0, 1, 2, 3], ordered_flat) self.assertEqual([0, 1, 2, 3], plain_flat) @parameterized.parameters({"mapping_type": collections.OrderedDict}, {"mapping_type": _CustomMapping}) def testPackDictOrder(self, mapping_type): """Packing orders dicts by key, including OrderedDicts.""" custom = mapping_type([("d", 0), ("b", 0), ("a", 0), ("c", 0)]) plain = {"d": 0, "b": 0, "a": 0, "c": 0} seq = [0, 1, 2, 3] custom_reconstruction = nest.pack_sequence_as(custom, seq) plain_reconstruction = nest.pack_sequence_as(plain, seq) self.assertIsInstance(custom_reconstruction, mapping_type) self.assertIsInstance(plain_reconstruction, dict) self.assertEqual( mapping_type([("d", 3), ("b", 1), ("a", 0), ("c", 2)]), custom_reconstruction) self.assertEqual({"d": 3, "b": 1, "a": 0, "c": 2}, plain_reconstruction) @test_util.assert_no_new_pyobjects_executing_eagerly def testFlattenAndPackMappingViews(self): """`flatten` orders dicts by key, including OrderedDicts.""" ordered = collections.OrderedDict([("d", 3), ("b", 1), ("a", 0), ("c", 2)]) # test flattening ordered_keys_flat = nest.flatten(ordered.keys()) ordered_values_flat = nest.flatten(ordered.values()) ordered_items_flat = nest.flatten(ordered.items()) self.assertEqual([3, 1, 0, 2], ordered_values_flat) self.assertEqual(["d", "b", "a", "c"], ordered_keys_flat) self.assertEqual(["d", 3, "b", 1, "a", 0, "c", 2], ordered_items_flat) # test packing self.assertEqual([("d", 3), ("b", 1), ("a", 0), ("c", 2)], nest.pack_sequence_as(ordered.items(), ordered_items_flat)) Abc = collections.namedtuple("A", ("b", "c")) # pylint: disable=invalid-name @test_util.assert_no_new_pyobjects_executing_eagerly def testFlattenAndPack_withDicts(self): # A nice messy mix of tuples, lists, dicts, and `OrderedDict`s. mess = [ "z", NestTest.Abc(3, 4), { "d": _CustomMapping({ 41: 4 }), "c": [ 1, collections.OrderedDict([ ("b", 3), ("a", 2), ]), ], "b": 5 }, 17 ] flattened = nest.flatten(mess) self.assertEqual(flattened, ["z", 3, 4, 5, 1, 2, 3, 4, 17]) structure_of_mess = [ 14, NestTest.Abc("a", True), { "d": _CustomMapping({ 41: 42 }), "c": [ 0, collections.OrderedDict([ ("b", 9), ("a", 8), ]), ], "b": 3 }, "hi everybody", ] unflattened = nest.pack_sequence_as(structure_of_mess, flattened) self.assertEqual(unflattened, mess) # Check also that the OrderedDict was created, with the correct key order. unflattened_ordered_dict = unflattened[2]["c"][1] self.assertIsInstance(unflattened_ordered_dict, collections.OrderedDict) self.assertEqual(list(unflattened_ordered_dict.keys()), ["b", "a"]) unflattened_custom_mapping = unflattened[2]["d"] self.assertIsInstance(unflattened_custom_mapping, _CustomMapping) self.assertEqual(list(unflattened_custom_mapping.keys()), [41]) def testFlatten_numpyIsNotFlattened(self): structure = np.array([1, 2, 3]) flattened = nest.flatten(structure) self.assertLen(flattened, 1) def testFlatten_stringIsNotFlattened(self): structure = "lots of letters" flattened = nest.flatten(structure) self.assertLen(flattened, 1) unflattened = nest.pack_sequence_as("goodbye", flattened) self.assertEqual(structure, unflattened) def testPackSequenceAs_notIterableError(self): with self.assertRaisesRegexp( TypeError, self.bad_pack_pattern): nest.pack_sequence_as("hi", "bye") def testPackSequenceAs_wrongLengthsError(self): with self.assertRaisesRegexp( ValueError, "Structure had 2 elements, but flat_sequence had 3 elements."): nest.pack_sequence_as(["hello", "world"], ["and", "goodbye", "again"]) @test_util.assert_no_new_pyobjects_executing_eagerly def testIsNested(self): self.assertFalse(nest.is_nested("1234")) self.assertTrue(nest.is_nested([1, 3, [4, 5]])) self.assertTrue(nest.is_nested(((7, 8), (5, 6)))) self.assertTrue(nest.is_nested([])) self.assertTrue(nest.is_nested({"a": 1, "b": 2})) self.assertTrue(nest.is_nested({"a": 1, "b": 2}.keys())) self.assertTrue(nest.is_nested({"a": 1, "b": 2}.values())) self.assertTrue(nest.is_nested({"a": 1, "b": 2}.items())) self.assertFalse(nest.is_nested(set([1, 2]))) ones = array_ops.ones([2, 3]) self.assertFalse(nest.is_nested(ones)) self.assertFalse(nest.is_nested(math_ops.tanh(ones))) self.assertFalse(nest.is_nested(np.ones((4, 5)))) @parameterized.parameters({"mapping_type": _CustomMapping}, {"mapping_type": dict}) def testFlattenDictItems(self, mapping_type): dictionary = mapping_type({(4, 5, (6, 8)): ("a", "b", ("c", "d"))}) flat = {4: "a", 5: "b", 6: "c", 8: "d"} self.assertEqual(nest.flatten_dict_items(dictionary), flat) with self.assertRaises(TypeError): nest.flatten_dict_items(4) bad_dictionary = mapping_type({(4, 5, (4, 8)): ("a", "b", ("c", "d"))}) with self.assertRaisesRegexp(ValueError, "not unique"): nest.flatten_dict_items(bad_dictionary) another_bad_dictionary = mapping_type({ (4, 5, (6, 8)): ("a", "b", ("c", ("d", "e"))) }) with self.assertRaisesRegexp( ValueError, "Key had [0-9]* elements, but value had [0-9]* elements"): nest.flatten_dict_items(another_bad_dictionary) # pylint does not correctly recognize these as class names and # suggests to use variable style under_score naming. # pylint: disable=invalid-name Named0ab = collections.namedtuple("named_0", ("a", "b")) Named1ab = collections.namedtuple("named_1", ("a", "b")) SameNameab = collections.namedtuple("same_name", ("a", "b")) SameNameab2 = collections.namedtuple("same_name", ("a", "b")) SameNamexy = collections.namedtuple("same_name", ("x", "y")) SameName1xy = collections.namedtuple("same_name_1", ("x", "y")) SameName1xy2 = collections.namedtuple("same_name_1", ("x", "y")) NotSameName = collections.namedtuple("not_same_name", ("a", "b")) # pylint: enable=invalid-name class SameNamedType1(SameNameab): pass @test_util.assert_no_new_pyobjects_executing_eagerly def testAssertSameStructure(self): structure1 = (((1, 2), 3), 4, (5, 6)) structure2 = ((("foo1", "foo2"), "foo3"), "foo4", ("foo5", "foo6")) structure_different_num_elements = ("spam", "eggs") structure_different_nesting = (((1, 2), 3), 4, 5, (6,)) nest.assert_same_structure(structure1, structure2) nest.assert_same_structure("abc", 1.0) nest.assert_same_structure("abc", np.array([0, 1])) nest.assert_same_structure("abc", constant_op.constant([0, 1])) with self.assertRaisesRegexp( ValueError, ("The two structures don't have the same nested structure\\.\n\n" "First structure:.*?\n\n" "Second structure:.*\n\n" "More specifically: Substructure " r'"type=tuple str=\(\(1, 2\), 3\)" is a sequence, while ' 'substructure "type=str str=spam" is not\n' "Entire first structure:\n" r"\(\(\(\., \.\), \.\), \., \(\., \.\)\)\n" "Entire second structure:\n" r"\(\., \.\)")): nest.assert_same_structure(structure1, structure_different_num_elements) with self.assertRaisesRegexp( ValueError, ("The two structures don't have the same nested structure\\.\n\n" "First structure:.*?\n\n" "Second structure:.*\n\n" r'More specifically: Substructure "type=list str=\[0, 1\]" ' r'is a sequence, while substructure "type=ndarray str=\[0 1\]" ' "is not")): nest.assert_same_structure([0, 1], np.array([0, 1])) with self.assertRaisesRegexp( ValueError, ("The two structures don't have the same nested structure\\.\n\n" "First structure:.*?\n\n" "Second structure:.*\n\n" r'More specifically: Substructure "type=list str=\[0, 1\]" ' 'is a sequence, while substructure "type=int str=0" ' "is not")): nest.assert_same_structure(0, [0, 1]) self.assertRaises(TypeError, nest.assert_same_structure, (0, 1), [0, 1]) with self.assertRaisesRegexp( ValueError, ("don't have the same nested structure\\.\n\n" "First structure: .*?\n\nSecond structure: ")): nest.assert_same_structure(structure1, structure_different_nesting) self.assertRaises(TypeError, nest.assert_same_structure, (0, 1), NestTest.Named0ab("a", "b")) nest.assert_same_structure(NestTest.Named0ab(3, 4), NestTest.Named0ab("a", "b")) self.assertRaises(TypeError, nest.assert_same_structure, NestTest.Named0ab(3, 4), NestTest.Named1ab(3, 4)) with self.assertRaisesRegexp( ValueError, ("don't have the same nested structure\\.\n\n" "First structure: .*?\n\nSecond structure: ")): nest.assert_same_structure(NestTest.Named0ab(3, 4), NestTest.Named0ab([3], 4)) with self.assertRaisesRegexp( ValueError, ("don't have the same nested structure\\.\n\n" "First structure: .*?\n\nSecond structure: ")): nest.assert_same_structure([[3], 4], [3, [4]]) structure1_list = [[[1, 2], 3], 4, [5, 6]] with self.assertRaisesRegexp(TypeError, "don't have the same sequence type"): nest.assert_same_structure(structure1, structure1_list) nest.assert_same_structure(structure1, structure2, check_types=False) nest.assert_same_structure(structure1, structure1_list, check_types=False) with self.assertRaisesRegexp(ValueError, "don't have the same set of keys"): nest.assert_same_structure({"a": 1}, {"b": 1}) nest.assert_same_structure(NestTest.SameNameab(0, 1), NestTest.SameNameab2(2, 3)) # This assertion is expected to pass: two namedtuples with the same # name and field names are considered to be identical. nest.assert_same_structure( NestTest.SameNameab(NestTest.SameName1xy(0, 1), 2), NestTest.SameNameab2(NestTest.SameName1xy2(2, 3), 4)) expected_message = "The two structures don't have the same.*" with self.assertRaisesRegexp(ValueError, expected_message): nest.assert_same_structure( NestTest.SameNameab(0, NestTest.SameNameab2(1, 2)), NestTest.SameNameab2(NestTest.SameNameab(0, 1), 2)) self.assertRaises(TypeError, nest.assert_same_structure, NestTest.SameNameab(0, 1), NestTest.NotSameName(2, 3)) self.assertRaises(TypeError, nest.assert_same_structure, NestTest.SameNameab(0, 1), NestTest.SameNamexy(2, 3)) self.assertRaises(TypeError, nest.assert_same_structure, NestTest.SameNameab(0, 1), NestTest.SameNamedType1(2, 3)) EmptyNT = collections.namedtuple("empty_nt", "") # pylint: disable=invalid-name def testHeterogeneousComparison(self): nest.assert_same_structure({"a": 4}, _CustomMapping(a=3)) nest.assert_same_structure(_CustomMapping(b=3), {"b": 4}) @test_util.assert_no_new_pyobjects_executing_eagerly def testMapStructure(self): structure1 = (((1, 2), 3), 4, (5, 6)) structure2 = (((7, 8), 9), 10, (11, 12)) structure1_plus1 = nest.map_structure(lambda x: x + 1, structure1) nest.assert_same_structure(structure1, structure1_plus1) self.assertAllEqual( [2, 3, 4, 5, 6, 7], nest.flatten(structure1_plus1)) structure1_plus_structure2 = nest.map_structure( lambda x, y: x + y, structure1, structure2) self.assertEqual( (((1 + 7, 2 + 8), 3 + 9), 4 + 10, (5 + 11, 6 + 12)), structure1_plus_structure2) self.assertEqual(3, nest.map_structure(lambda x: x - 1, 4)) self.assertEqual(7, nest.map_structure(lambda x, y: x + y, 3, 4)) structure3 = collections.defaultdict(list) structure3["a"] = [1, 2, 3, 4] structure3["b"] = [2, 3, 4, 5] expected_structure3 = collections.defaultdict(list) expected_structure3["a"] = [2, 3, 4, 5] expected_structure3["b"] = [3, 4, 5, 6] self.assertEqual(expected_structure3, nest.map_structure(lambda x: x + 1, structure3)) # Empty structures self.assertEqual((), nest.map_structure(lambda x: x + 1, ())) self.assertEqual([], nest.map_structure(lambda x: x + 1, [])) self.assertEqual({}, nest.map_structure(lambda x: x + 1, {})) self.assertEqual(NestTest.EmptyNT(), nest.map_structure(lambda x: x + 1, NestTest.EmptyNT())) # This is checking actual equality of types, empty list != empty tuple self.assertNotEqual((), nest.map_structure(lambda x: x + 1, [])) with self.assertRaisesRegexp(TypeError, "callable"): nest.map_structure("bad", structure1_plus1) with self.assertRaisesRegexp(ValueError, "at least one structure"): nest.map_structure(lambda x: x) with self.assertRaisesRegexp(ValueError, "same number of elements"): nest.map_structure(lambda x, y: None, (3, 4), (3, 4, 5)) with self.assertRaisesRegexp(ValueError, "same nested structure"): nest.map_structure(lambda x, y: None, 3, (3,)) with self.assertRaisesRegexp(TypeError, "same sequence type"): nest.map_structure(lambda x, y: None, ((3, 4), 5), [(3, 4), 5]) with self.assertRaisesRegexp(ValueError, "same nested structure"): nest.map_structure(lambda x, y: None, ((3, 4), 5), (3, (4, 5))) structure1_list = [[[1, 2], 3], 4, [5, 6]] with self.assertRaisesRegexp(TypeError, "same sequence type"): nest.map_structure(lambda x, y: None, structure1, structure1_list) nest.map_structure(lambda x, y: None, structure1, structure1_list, check_types=False) with self.assertRaisesRegexp(ValueError, "same nested structure"): nest.map_structure(lambda x, y: None, ((3, 4), 5), (3, (4, 5)), check_types=False) with self.assertRaisesRegexp(ValueError, "Only valid keyword argument.*foo"): nest.map_structure(lambda x: None, structure1, foo="a") with self.assertRaisesRegexp(ValueError, "Only valid keyword argument.*foo"): nest.map_structure(lambda x: None, structure1, check_types=False, foo="a") ABTuple = collections.namedtuple("ab_tuple", "a, b") # pylint: disable=invalid-name @test_util.assert_no_new_pyobjects_executing_eagerly def testMapStructureWithStrings(self): inp_a = NestTest.ABTuple(a="foo", b=("bar", "baz")) inp_b = NestTest.ABTuple(a=2, b=(1, 3)) out = nest.map_structure(lambda string, repeats: string * repeats, inp_a, inp_b) self.assertEqual("foofoo", out.a) self.assertEqual("bar", out.b[0]) self.assertEqual("bazbazbaz", out.b[1]) nt = NestTest.ABTuple(a=("something", "something_else"), b="yet another thing") rev_nt = nest.map_structure(lambda x: x[::-1], nt) # Check the output is the correct structure, and all strings are reversed. nest.assert_same_structure(nt, rev_nt) self.assertEqual(nt.a[0][::-1], rev_nt.a[0]) self.assertEqual(nt.a[1][::-1], rev_nt.a[1]) self.assertEqual(nt.b[::-1], rev_nt.b) @test_util.run_deprecated_v1 def testMapStructureOverPlaceholders(self): inp_a = (array_ops.placeholder(dtypes.float32, shape=[3, 4]), array_ops.placeholder(dtypes.float32, shape=[3, 7])) inp_b = (array_ops.placeholder(dtypes.float32, shape=[3, 4]), array_ops.placeholder(dtypes.float32, shape=[3, 7])) output = nest.map_structure(lambda x1, x2: x1 + x2, inp_a, inp_b) nest.assert_same_structure(output, inp_a) self.assertShapeEqual(np.zeros((3, 4)), output[0]) self.assertShapeEqual(np.zeros((3, 7)), output[1]) feed_dict = { inp_a: (np.random.randn(3, 4), np.random.randn(3, 7)), inp_b: (np.random.randn(3, 4), np.random.randn(3, 7)) } with self.cached_session() as sess: output_np = sess.run(output, feed_dict=feed_dict) self.assertAllClose(output_np[0], feed_dict[inp_a][0] + feed_dict[inp_b][0]) self.assertAllClose(output_np[1], feed_dict[inp_a][1] + feed_dict[inp_b][1]) def testAssertShallowStructure(self): inp_ab = ["a", "b"] inp_abc = ["a", "b", "c"] with self.assertRaisesWithLiteralMatch( # pylint: disable=g-error-prone-assert-raises ValueError, nest._STRUCTURES_HAVE_MISMATCHING_LENGTHS.format( input_length=len(inp_ab), shallow_length=len(inp_abc))): nest.assert_shallow_structure(inp_abc, inp_ab) inp_ab1 = [(1, 1), (2, 2)] inp_ab2 = [[1, 1], [2, 2]] with self.assertRaisesWithLiteralMatch( TypeError, nest._STRUCTURES_HAVE_MISMATCHING_TYPES.format( shallow_type=type(inp_ab2[0]), input_type=type(inp_ab1[0]))): nest.assert_shallow_structure(inp_ab2, inp_ab1) nest.assert_shallow_structure(inp_ab2, inp_ab1, check_types=False) inp_ab1 = {"a": (1, 1), "b": {"c": (2, 2)}} inp_ab2 = {"a": (1, 1), "b": {"d": (2, 2)}} with self.assertRaisesWithLiteralMatch( ValueError, nest._SHALLOW_TREE_HAS_INVALID_KEYS.format(["d"])): nest.assert_shallow_structure(inp_ab2, inp_ab1) inp_ab = collections.OrderedDict([("a", 1), ("b", (2, 3))]) inp_ba = collections.OrderedDict([("b", (2, 3)), ("a", 1)]) nest.assert_shallow_structure(inp_ab, inp_ba) # This assertion is expected to pass: two namedtuples with the same # name and field names are considered to be identical. inp_shallow = NestTest.SameNameab(1, 2) inp_deep = NestTest.SameNameab2(1, [1, 2, 3]) nest.assert_shallow_structure(inp_shallow, inp_deep, check_types=False) nest.assert_shallow_structure(inp_shallow, inp_deep, check_types=True) def testFlattenUpTo(self): # Shallow tree ends at scalar. input_tree = [[[2, 2], [3, 3]], [[4, 9], [5, 5]]] shallow_tree = [[True, True], [False, True]] flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [[2, 2], [3, 3], [4, 9], [5, 5]]) self.assertEqual(flattened_shallow_tree, [True, True, False, True]) # Shallow tree ends at string. input_tree = [[("a", 1), [("b", 2), [("c", 3), [("d", 4)]]]]] shallow_tree = [["level_1", ["level_2", ["level_3", ["level_4"]]]]] input_tree_flattened_as_shallow_tree = nest.flatten_up_to(shallow_tree, input_tree) input_tree_flattened = nest.flatten(input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree, [("a", 1), ("b", 2), ("c", 3), ("d", 4)]) self.assertEqual(input_tree_flattened, ["a", 1, "b", 2, "c", 3, "d", 4]) # Make sure dicts are correctly flattened, yielding values, not keys. input_tree = {"a": 1, "b": {"c": 2}, "d": [3, (4, 5)]} shallow_tree = {"a": 0, "b": 0, "d": [0, 0]} input_tree_flattened_as_shallow_tree = nest.flatten_up_to(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree, [1, {"c": 2}, 3, (4, 5)]) # Namedtuples. ab_tuple = NestTest.ABTuple input_tree = ab_tuple(a=[0, 1], b=2) shallow_tree = ab_tuple(a=0, b=1) input_tree_flattened_as_shallow_tree = nest.flatten_up_to(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree, [[0, 1], 2]) # Nested dicts, OrderedDicts and namedtuples. input_tree = collections.OrderedDict( [("a", ab_tuple(a=[0, {"b": 1}], b=2)), ("c", {"d": 3, "e": collections.OrderedDict([("f", 4)])})]) shallow_tree = input_tree input_tree_flattened_as_shallow_tree = nest.flatten_up_to(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree, [0, 1, 2, 3, 4]) shallow_tree = collections.OrderedDict([("a", 0), ("c", {"d": 3, "e": 1})]) input_tree_flattened_as_shallow_tree = nest.flatten_up_to(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree, [ab_tuple(a=[0, {"b": 1}], b=2), 3, collections.OrderedDict([("f", 4)])]) shallow_tree = collections.OrderedDict([("a", 0), ("c", 0)]) input_tree_flattened_as_shallow_tree = nest.flatten_up_to(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree, [ab_tuple(a=[0, {"b": 1}], b=2), {"d": 3, "e": collections.OrderedDict([("f", 4)])}]) ## Shallow non-list edge-case. # Using iterable elements. input_tree = ["input_tree"] shallow_tree = "shallow_tree" flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) input_tree = ["input_tree_0", "input_tree_1"] shallow_tree = "shallow_tree" flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) # Using non-iterable elements. input_tree = [0] shallow_tree = 9 flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) input_tree = [0, 1] shallow_tree = 9 flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) ## Both non-list edge-case. # Using iterable elements. input_tree = "input_tree" shallow_tree = "shallow_tree" flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) # Using non-iterable elements. input_tree = 0 shallow_tree = 0 flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) ## Input non-list edge-case. # Using iterable elements. input_tree = "input_tree" shallow_tree = ["shallow_tree"] expected_message = ("If shallow structure is a sequence, input must also " "be a sequence. Input has type: <(type|class) 'str'>.") with self.assertRaisesRegexp(TypeError, expected_message): flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree, shallow_tree) input_tree = "input_tree" shallow_tree = ["shallow_tree_9", "shallow_tree_8"] with self.assertRaisesRegexp(TypeError, expected_message): flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree, shallow_tree) # Using non-iterable elements. input_tree = 0 shallow_tree = [9] expected_message = ("If shallow structure is a sequence, input must also " "be a sequence. Input has type: <(type|class) 'int'>.") with self.assertRaisesRegexp(TypeError, expected_message): flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree, shallow_tree) input_tree = 0 shallow_tree = [9, 8] with self.assertRaisesRegexp(TypeError, expected_message): flattened_input_tree = nest.flatten_up_to(shallow_tree, input_tree) flattened_shallow_tree = nest.flatten_up_to(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree, shallow_tree) input_tree = [(1,), (2,), 3] shallow_tree = [(1,), (2,)] expected_message = nest._STRUCTURES_HAVE_MISMATCHING_LENGTHS.format( input_length=len(input_tree), shallow_length=len(shallow_tree)) with self.assertRaisesRegexp(ValueError, expected_message): # pylint: disable=g-error-prone-assert-raises nest.assert_shallow_structure(shallow_tree, input_tree) def testFlattenWithTuplePathsUpTo(self): def get_paths_and_values(shallow_tree, input_tree): path_value_pairs = nest.flatten_with_tuple_paths_up_to( shallow_tree, input_tree) paths = [p for p, _ in path_value_pairs] values = [v for _, v in path_value_pairs] return paths, values # Shallow tree ends at scalar. input_tree = [[[2, 2], [3, 3]], [[4, 9], [5, 5]]] shallow_tree = [[True, True], [False, True]] (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [(0, 0), (0, 1), (1, 0), (1, 1)]) self.assertEqual(flattened_input_tree, [[2, 2], [3, 3], [4, 9], [5, 5]]) self.assertEqual(flattened_shallow_tree_paths, [(0, 0), (0, 1), (1, 0), (1, 1)]) self.assertEqual(flattened_shallow_tree, [True, True, False, True]) # Shallow tree ends at string. input_tree = [[("a", 1), [("b", 2), [("c", 3), [("d", 4)]]]]] shallow_tree = [["level_1", ["level_2", ["level_3", ["level_4"]]]]] (input_tree_flattened_as_shallow_tree_paths, input_tree_flattened_as_shallow_tree) = get_paths_and_values(shallow_tree, input_tree) input_tree_flattened_paths = [p for p, _ in nest.flatten_with_tuple_paths(input_tree)] input_tree_flattened = nest.flatten(input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree_paths, [(0, 0), (0, 1, 0), (0, 1, 1, 0), (0, 1, 1, 1, 0)]) self.assertEqual(input_tree_flattened_as_shallow_tree, [("a", 1), ("b", 2), ("c", 3), ("d", 4)]) self.assertEqual(input_tree_flattened_paths, [(0, 0, 0), (0, 0, 1), (0, 1, 0, 0), (0, 1, 0, 1), (0, 1, 1, 0, 0), (0, 1, 1, 0, 1), (0, 1, 1, 1, 0, 0), (0, 1, 1, 1, 0, 1)]) self.assertEqual(input_tree_flattened, ["a", 1, "b", 2, "c", 3, "d", 4]) # Make sure dicts are correctly flattened, yielding values, not keys. input_tree = {"a": 1, "b": {"c": 2}, "d": [3, (4, 5)]} shallow_tree = {"a": 0, "b": 0, "d": [0, 0]} (input_tree_flattened_as_shallow_tree_paths, input_tree_flattened_as_shallow_tree) = get_paths_and_values(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree_paths, [("a",), ("b",), ("d", 0), ("d", 1)]) self.assertEqual(input_tree_flattened_as_shallow_tree, [1, {"c": 2}, 3, (4, 5)]) # Namedtuples. ab_tuple = collections.namedtuple("ab_tuple", "a, b") input_tree = ab_tuple(a=[0, 1], b=2) shallow_tree = ab_tuple(a=0, b=1) (input_tree_flattened_as_shallow_tree_paths, input_tree_flattened_as_shallow_tree) = get_paths_and_values(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree_paths, [("a",), ("b",)]) self.assertEqual(input_tree_flattened_as_shallow_tree, [[0, 1], 2]) # Nested dicts, OrderedDicts and namedtuples. input_tree = collections.OrderedDict( [("a", ab_tuple(a=[0, {"b": 1}], b=2)), ("c", {"d": 3, "e": collections.OrderedDict([("f", 4)])})]) shallow_tree = input_tree (input_tree_flattened_as_shallow_tree_paths, input_tree_flattened_as_shallow_tree) = get_paths_and_values(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree_paths, [("a", "a", 0), ("a", "a", 1, "b"), ("a", "b"), ("c", "d"), ("c", "e", "f")]) self.assertEqual(input_tree_flattened_as_shallow_tree, [0, 1, 2, 3, 4]) shallow_tree = collections.OrderedDict([("a", 0), ("c", {"d": 3, "e": 1})]) (input_tree_flattened_as_shallow_tree_paths, input_tree_flattened_as_shallow_tree) = get_paths_and_values(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree_paths, [("a",), ("c", "d"), ("c", "e")]) self.assertEqual(input_tree_flattened_as_shallow_tree, [ab_tuple(a=[0, {"b": 1}], b=2), 3, collections.OrderedDict([("f", 4)])]) shallow_tree = collections.OrderedDict([("a", 0), ("c", 0)]) (input_tree_flattened_as_shallow_tree_paths, input_tree_flattened_as_shallow_tree) = get_paths_and_values(shallow_tree, input_tree) self.assertEqual(input_tree_flattened_as_shallow_tree_paths, [("a",), ("c",)]) self.assertEqual(input_tree_flattened_as_shallow_tree, [ab_tuple(a=[0, {"b": 1}], b=2), {"d": 3, "e": collections.OrderedDict([("f", 4)])}]) ## Shallow non-list edge-case. # Using iterable elements. input_tree = ["input_tree"] shallow_tree = "shallow_tree" (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [()]) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree_paths, [()]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) input_tree = ["input_tree_0", "input_tree_1"] shallow_tree = "shallow_tree" (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [()]) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree_paths, [()]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) # Test case where len(shallow_tree) < len(input_tree) input_tree = {"a": "A", "b": "B", "c": "C"} shallow_tree = {"a": 1, "c": 2} with self.assertRaisesWithLiteralMatch( # pylint: disable=g-error-prone-assert-raises ValueError, nest._STRUCTURES_HAVE_MISMATCHING_LENGTHS.format( input_length=len(input_tree), shallow_length=len(shallow_tree))): get_paths_and_values(shallow_tree, input_tree) # Using non-iterable elements. input_tree = [0] shallow_tree = 9 (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [()]) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree_paths, [()]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) input_tree = [0, 1] shallow_tree = 9 (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [()]) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree_paths, [()]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) ## Both non-list edge-case. # Using iterable elements. input_tree = "input_tree" shallow_tree = "shallow_tree" (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [()]) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree_paths, [()]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) # Using non-iterable elements. input_tree = 0 shallow_tree = 0 (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_input_tree_paths, [()]) self.assertEqual(flattened_input_tree, [input_tree]) self.assertEqual(flattened_shallow_tree_paths, [()]) self.assertEqual(flattened_shallow_tree, [shallow_tree]) ## Input non-list edge-case. # Using iterable elements. input_tree = "input_tree" shallow_tree = ["shallow_tree"] with self.assertRaisesWithLiteralMatch( TypeError, nest._IF_SHALLOW_IS_SEQ_INPUT_MUST_BE_SEQ.format(type(input_tree))): (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree_paths, [(0,)]) self.assertEqual(flattened_shallow_tree, shallow_tree) input_tree = "input_tree" shallow_tree = ["shallow_tree_9", "shallow_tree_8"] with self.assertRaisesWithLiteralMatch( TypeError, nest._IF_SHALLOW_IS_SEQ_INPUT_MUST_BE_SEQ.format(type(input_tree))): (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree_paths, [(0,), (1,)]) self.assertEqual(flattened_shallow_tree, shallow_tree) # Using non-iterable elements. input_tree = 0 shallow_tree = [9] with self.assertRaisesWithLiteralMatch( TypeError, nest._IF_SHALLOW_IS_SEQ_INPUT_MUST_BE_SEQ.format(type(input_tree))): (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree_paths, [(0,)]) self.assertEqual(flattened_shallow_tree, shallow_tree) input_tree = 0 shallow_tree = [9, 8] with self.assertRaisesWithLiteralMatch( TypeError, nest._IF_SHALLOW_IS_SEQ_INPUT_MUST_BE_SEQ.format(type(input_tree))): (flattened_input_tree_paths, flattened_input_tree) = get_paths_and_values(shallow_tree, input_tree) (flattened_shallow_tree_paths, flattened_shallow_tree) = get_paths_and_values(shallow_tree, shallow_tree) self.assertEqual(flattened_shallow_tree_paths, [(0,), (1,)]) self.assertEqual(flattened_shallow_tree, shallow_tree) def testMapStructureUpTo(self): # Named tuples. ab_tuple = collections.namedtuple("ab_tuple", "a, b") op_tuple = collections.namedtuple("op_tuple", "add, mul") inp_val = ab_tuple(a=2, b=3) inp_ops = ab_tuple(a=op_tuple(add=1, mul=2), b=op_tuple(add=2, mul=3)) out = nest.map_structure_up_to( inp_val, lambda val, ops: (val + ops.add) * ops.mul, inp_val, inp_ops) self.assertEqual(out.a, 6) self.assertEqual(out.b, 15) # Lists. data_list = [[2, 4, 6, 8], [[1, 3, 5, 7, 9], [3, 5, 7]]] name_list = ["evens", ["odds", "primes"]] out = nest.map_structure_up_to( name_list, lambda name, sec: "first_{}_{}".format(len(sec), name), name_list, data_list) self.assertEqual(out, ["first_4_evens", ["first_5_odds", "first_3_primes"]]) # Dicts. inp_val = dict(a=2, b=3) inp_ops = dict(a=dict(add=1, mul=2), b=dict(add=2, mul=3)) out = nest.map_structure_up_to( inp_val, lambda val, ops: (val + ops["add"]) * ops["mul"], inp_val, inp_ops) self.assertEqual(out["a"], 6) self.assertEqual(out["b"], 15) # Non-equal dicts. inp_val = dict(a=2, b=3) inp_ops = dict(a=dict(add=1, mul=2), c=dict(add=2, mul=3)) with self.assertRaisesWithLiteralMatch( ValueError, nest._SHALLOW_TREE_HAS_INVALID_KEYS.format(["b"])): nest.map_structure_up_to( inp_val, lambda val, ops: (val + ops["add"]) * ops["mul"], inp_val, inp_ops) # Dict+custom mapping. inp_val = dict(a=2, b=3) inp_ops = _CustomMapping(a=dict(add=1, mul=2), b=dict(add=2, mul=3)) out = nest.map_structure_up_to( inp_val, lambda val, ops: (val + ops["add"]) * ops["mul"], inp_val, inp_ops) self.assertEqual(out["a"], 6) self.assertEqual(out["b"], 15) # Non-equal dict/mapping. inp_val = dict(a=2, b=3) inp_ops = _CustomMapping(a=dict(add=1, mul=2), c=dict(add=2, mul=3)) with self.assertRaisesWithLiteralMatch( ValueError, nest._SHALLOW_TREE_HAS_INVALID_KEYS.format(["b"])): nest.map_structure_up_to( inp_val, lambda val, ops: (val + ops["add"]) * ops["mul"], inp_val, inp_ops) def testGetTraverseShallowStructure(self): scalar_traverse_input = [3, 4, (1, 2, [0]), [5, 6], {"a": (7,)}, []] scalar_traverse_r = nest.get_traverse_shallow_structure( lambda s: not isinstance(s, tuple), scalar_traverse_input) self.assertEqual(scalar_traverse_r, [True, True, False, [True, True], {"a": False}, []]) nest.assert_shallow_structure(scalar_traverse_r, scalar_traverse_input) structure_traverse_input = [(1, [2]), ([1], 2)] structure_traverse_r = nest.get_traverse_shallow_structure( lambda s: (True, False) if isinstance(s, tuple) else True, structure_traverse_input) self.assertEqual(structure_traverse_r, [(True, False), ([True], False)]) nest.assert_shallow_structure(structure_traverse_r, structure_traverse_input) with self.assertRaisesRegexp(TypeError, "returned structure"): nest.get_traverse_shallow_structure(lambda _: [True], 0) with self.assertRaisesRegexp(TypeError, "returned a non-bool scalar"): nest.get_traverse_shallow_structure(lambda _: 1, [1]) with self.assertRaisesRegexp( TypeError, "didn't return a depth=1 structure of bools"): nest.get_traverse_shallow_structure(lambda _: [1], [1]) def testYieldFlatStringPaths(self): for inputs_expected in ({"inputs": [], "expected": []}, {"inputs": 3, "expected": [()]}, {"inputs": [3], "expected": [(0,)]}, {"inputs": {"a": 3}, "expected": [("a",)]}, {"inputs": {"a": {"b": 4}}, "expected": [("a", "b")]}, {"inputs": [{"a": 2}], "expected": [(0, "a")]}, {"inputs": [{"a": [2]}], "expected": [(0, "a", 0)]}, {"inputs": [{"a": [(23, 42)]}], "expected": [(0, "a", 0, 0), (0, "a", 0, 1)]}, {"inputs": [{"a": ([23], 42)}], "expected": [(0, "a", 0, 0), (0, "a", 1)]}, {"inputs": {"a": {"a": 2}, "c": [[[4]]]}, "expected": [("a", "a"), ("c", 0, 0, 0)]}, {"inputs": {"0": [{"1": 23}]}, "expected": [("0", 0, "1")]}): inputs = inputs_expected["inputs"] expected = inputs_expected["expected"] self.assertEqual(list(nest.yield_flat_paths(inputs)), expected) # We cannot define namedtuples within @parameterized argument lists. # pylint: disable=invalid-name Foo = collections.namedtuple("Foo", ["a", "b"]) Bar = collections.namedtuple("Bar", ["c", "d"]) # pylint: enable=invalid-name @parameterized.parameters([ dict(inputs=[], expected=[]), dict(inputs=[23, "42"], expected=[("0", 23), ("1", "42")]), dict(inputs=[[[[108]]]], expected=[("0/0/0/0", 108)]), dict(inputs=Foo(a=3, b=Bar(c=23, d=42)), expected=[("a", 3), ("b/c", 23), ("b/d", 42)]), dict(inputs=Foo(a=Bar(c=23, d=42), b=Bar(c=0, d="thing")), expected=[("a/c", 23), ("a/d", 42), ("b/c", 0), ("b/d", "thing")]), dict(inputs=Bar(c=42, d=43), expected=[("c", 42), ("d", 43)]), dict(inputs=Bar(c=[42], d=43), expected=[("c/0", 42), ("d", 43)]), ]) def testFlattenWithStringPaths(self, inputs, expected): self.assertEqual( nest.flatten_with_joined_string_paths(inputs, separator="/"), expected) @parameterized.parameters([ dict(inputs=[], expected=[]), dict(inputs=[23, "42"], expected=[((0,), 23), ((1,), "42")]), dict(inputs=[[[[108]]]], expected=[((0, 0, 0, 0), 108)]), dict(inputs=Foo(a=3, b=Bar(c=23, d=42)), expected=[(("a",), 3), (("b", "c"), 23), (("b", "d"), 42)]), dict(inputs=Foo(a=Bar(c=23, d=42), b=Bar(c=0, d="thing")), expected=[(("a", "c"), 23), (("a", "d"), 42), (("b", "c"), 0), (("b", "d"), "thing")]), dict(inputs=Bar(c=42, d=43), expected=[(("c",), 42), (("d",), 43)]), dict(inputs=Bar(c=[42], d=43), expected=[(("c", 0), 42), (("d",), 43)]), ]) def testFlattenWithTuplePaths(self, inputs, expected): self.assertEqual(nest.flatten_with_tuple_paths(inputs), expected) @parameterized.named_parameters( ("tuples", (1, 2), (3, 4), True, (("0", 4), ("1", 6))), ("dicts", {"a": 1, "b": 2}, {"b": 4, "a": 3}, True, {"a": ("a", 4), "b": ("b", 6)}), ("mixed", (1, 2), [3, 4], False, (("0", 4), ("1", 6))), ("nested", {"a": [2, 3], "b": [1, 2, 3]}, {"b": [5, 6, 7], "a": [8, 9]}, True, {"a": [("a/0", 10), ("a/1", 12)], "b": [("b/0", 6), ("b/1", 8), ("b/2", 10)]})) def testMapWithPathsCompatibleStructures(self, s1, s2, check_types, expected): def format_sum(path, *values): return (path, sum(values)) result = nest.map_structure_with_paths(format_sum, s1, s2, check_types=check_types) self.assertEqual(expected, result) @parameterized.named_parameters( ("tuples", (1, 2, 3), (4, 5), ValueError), ("dicts", {"a": 1}, {"b": 2}, ValueError), ("mixed", (1, 2), [3, 4], TypeError), ("nested", {"a": [2, 3, 4], "b": [1, 3]}, {"b": [5, 6], "a": [8, 9]}, ValueError )) def testMapWithPathsIncompatibleStructures(self, s1, s2, error_type): with self.assertRaises(error_type): nest.map_structure_with_paths(lambda path, *s: 0, s1, s2) @parameterized.named_parameters([ dict(testcase_name="Tuples", s1=(1, 2), s2=(3, 4), check_types=True, expected=(((0,), 4), ((1,), 6))), dict(testcase_name="Dicts", s1={"a": 1, "b": 2}, s2={"b": 4, "a": 3}, check_types=True, expected={"a": (("a",), 4), "b": (("b",), 6)}), dict(testcase_name="Mixed", s1=(1, 2), s2=[3, 4], check_types=False, expected=(((0,), 4), ((1,), 6))), dict(testcase_name="Nested",<|fim▁hole|> check_types=True, expected={"a": [(("a", 0), 10), (("a", 1), 12)], "b": [(("b", 0), 6), (("b", 1), 8), (("b", 2), 10)]}), ]) def testMapWithTuplePathsCompatibleStructures( self, s1, s2, check_types, expected): def path_and_sum(path, *values): return path, sum(values) result = nest.map_structure_with_tuple_paths( path_and_sum, s1, s2, check_types=check_types) self.assertEqual(expected, result) @parameterized.named_parameters([ dict(testcase_name="Tuples", s1=(1, 2, 3), s2=(4, 5), error_type=ValueError), dict(testcase_name="Dicts", s1={"a": 1}, s2={"b": 2}, error_type=ValueError), dict(testcase_name="Mixed", s1=(1, 2), s2=[3, 4], error_type=TypeError), dict(testcase_name="Nested", s1={"a": [2, 3, 4], "b": [1, 3]}, s2={"b": [5, 6], "a": [8, 9]}, error_type=ValueError) ]) def testMapWithTuplePathsIncompatibleStructures(self, s1, s2, error_type): with self.assertRaises(error_type): nest.map_structure_with_tuple_paths(lambda path, *s: 0, s1, s2) def testFlattenCustomSequenceThatRaisesException(self): # b/140746865 seq = _CustomSequenceThatRaisesException() with self.assertRaisesRegexp(ValueError, "Cannot get item"): nest.flatten(seq) def testListToTuple(self): input_sequence = [1, (2, {3: [4, 5, (6,)]}, None, 7, [[[8]]])] expected = (1, (2, {3: (4, 5, (6,))}, None, 7, (((8,),),))) nest.assert_same_structure( nest.list_to_tuple(input_sequence), expected, ) class NestBenchmark(test.Benchmark): def run_and_report(self, s1, s2, name): burn_iter, test_iter = 100, 30000 for _ in xrange(burn_iter): nest.assert_same_structure(s1, s2) t0 = time.time() for _ in xrange(test_iter): nest.assert_same_structure(s1, s2) t1 = time.time() self.report_benchmark(iters=test_iter, wall_time=(t1 - t0) / test_iter, name=name) def benchmark_assert_structure(self): s1 = (((1, 2), 3), 4, (5, 6)) s2 = ((("foo1", "foo2"), "foo3"), "foo4", ("foo5", "foo6")) self.run_and_report(s1, s2, "assert_same_structure_6_elem") s1 = (((1, 2), 3), 4, (5, 6)) * 10 s2 = ((("foo1", "foo2"), "foo3"), "foo4", ("foo5", "foo6")) * 10 self.run_and_report(s1, s2, "assert_same_structure_60_elem") if __name__ == "__main__": test.main()<|fim▁end|>
s1={"a": [2, 3], "b": [1, 2, 3]}, s2={"b": [5, 6, 7], "a": [8, 9]},
<|file_name|>validate_plug_ins.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import sys try: import __builtin__ except ImportError: import builtins as __builtin__ import os # python puts the program's directory path in sys.path[0]. In other words, the user ordinarily has no way # to override python's choice of a module from its own dir. We want to have that ability in our environment. # However, we don't want to break any established python modules that depend on this behavior. So, we'll # save the value from sys.path[0], delete it, import our modules and then restore sys.path to its original # value. save_path_0 = sys.path[0] del sys.path[0] from gen_print import * from gen_arg import * from gen_plug_in import * # Restore sys.path[0]. sys.path.insert(0, save_path_0) # Create parser object to process command line parameters and args. # Create parser object. parser = argparse.ArgumentParser( usage='%(prog)s [OPTIONS] [PLUG_IN_DIR_PATHS]', description="%(prog)s will validate the plug-in packages passed to it." + " It will also print a list of the absolute plug-in" + " directory paths for use by the calling program.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, prefix_chars='-+') # Create arguments. parser.add_argument( 'plug_in_dir_paths', nargs='?', default="", help=plug_in_dir_paths_help_text + default_string) parser.add_argument( '--mch_class', default="obmc", help=mch_class_help_text + default_string) # The stock_list will be passed to gen_get_options. We populate it with the names of stock parm options we # want. These stock parms are pre-defined by gen_get_options. stock_list = [("test_mode", 0), ("quiet", 1), ("debug", 0)] def exit_function(signal_number=0, frame=None): r""" Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). """ dprint_executing() dprint_var(signal_number) <|fim▁hole|> def signal_handler(signal_number, frame): r""" Handle signals. Without a function to catch a SIGTERM or SIGINT, our program would terminate immediately with return code 143 and without calling our exit_function. """ # Our convention is to set up exit_function with atexit.registr() so there is no need to explicitly call # exit_function from here. dprint_executing() # Calling exit prevents us from returning to the code that was running when we received the signal. exit(0) def validate_parms(): r""" Validate program parameters, etc. Return True or False accordingly. """ gen_post_validation(exit_function, signal_handler) return True def main(): r""" This is the "main" function. The advantage of having this function vs just doing this in the true mainline is that you can: - Declare local variables - Use "return" instead of "exit". - Indent 4 chars like you would in any function. This makes coding more consistent, i.e. it's easy to move code from here into a function and vice versa. """ if not gen_get_options(parser, stock_list): return False if not validate_parms(): return False qprint_pgm_header() # Access program parameter globals. global plug_in_dir_paths global mch_class plug_in_packages_list = return_plug_in_packages_list(plug_in_dir_paths, mch_class) qprint_var(plug_in_packages_list) # As stated in the help text, this program must print the full paths of each selected plug in. for plug_in_dir_path in plug_in_packages_list: print(plug_in_dir_path) return True # Main if not main(): exit(1)<|fim▁end|>
qprint_pgm_footer()
<|file_name|>build.js<|end_file_name|><|fim▁begin|>const fs = require("fs"); const path = require("path"); const {template} = require("lodash"); const minimist = require("minimist"); const yaml = require("js-yaml"); const argv = minimist(process.argv.slice(2)); const conf = {}; try { const src = fs.readFileSync(path.resolve(__dirname, "../deploy-config.yml")); const yml = yaml.safeLoad(src); Object.assign(conf, yml); if (argv.env && yml[argv.env]) Object.assign(conf, yml[argv.env]); else if (yml.env && yml[yml.env]) Object.assign(conf, yml[yml.env]); } catch(e) { if (e.code !== "ENOENT") console.error(e); } Object.assign(conf, argv); function walkfs(file, exts, fn) { const stat = fs.statSync(file); if (stat.isDirectory()) { fs.readdirSync(file).forEach(name => { walkfs(path.join(file, name), exts, fn); }); } else if (exts.includes(path.extname(file))) { const src = fs.readFileSync(file, "utf-8"); fn(src, file); } } function build(dir, out, exts, join="", mode) { const result = []; walkfs(dir, exts, (src, file) => { const data = Object.assign({}, conf, { __filename: file, __dirname: path.dirname(file) }); const opts = { variable: "$", imports: {} }; result.push(template(src, opts)(data).trim() + "\n"); }); if (result) { fs.writeFileSync(out, result.join(join + "\n"), { mode }); } } build(<|fim▁hole|> [ ".yml" ], "---" );<|fim▁end|>
path.join(__dirname, "kube-conf"), path.resolve(__dirname, "../kubernetes.yml"),
<|file_name|>Variable.js<|end_file_name|><|fim▁begin|>"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Variable = void 0; const VariableBase_1 = require("./VariableBase"); /** * A Variable represents a locally scoped identifier. These include arguments to functions. */ class Variable extends VariableBase_1.VariableBase { /** * `true` if the variable is valid in a type context, false otherwise * @public */ get isTypeVariable() { if (this.defs.length === 0) { // we don't statically know whether this is a type or a value return true; } return this.defs.some(def => def.isTypeDefinition); } /** * `true` if the variable is valid in a value context, false otherwise * @public */ get isValueVariable() { if (this.defs.length === 0) { // we don't statically know whether this is a type or a value return true;<|fim▁hole|> } return this.defs.some(def => def.isVariableDefinition); } } exports.Variable = Variable; //# sourceMappingURL=Variable.js.map<|fim▁end|>
<|file_name|>transactionPending.js<|end_file_name|><|fim▁begin|>// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 // (at your option) any later version. // Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>. import React, { Component, PropTypes } from 'react'; import { observer } from 'mobx-react'; import { Button, GasPriceEditor } from '~/ui'; import TransactionMainDetails from '../TransactionMainDetails'; import TransactionPendingForm from '../TransactionPendingForm'; import styles from './transactionPending.css'; import * as tUtil from '../util/transaction'; @observer export default class TransactionPending extends Component { static contextTypes = { api: PropTypes.object.isRequired }; static propTypes = { className: PropTypes.string, date: PropTypes.instanceOf(Date).isRequired, focus: PropTypes.bool, gasLimit: PropTypes.object, id: PropTypes.object.isRequired, isSending: PropTypes.bool.isRequired, isTest: PropTypes.bool.isRequired, nonce: PropTypes.number, onConfirm: PropTypes.func.isRequired, onReject: PropTypes.func.isRequired, store: PropTypes.object.isRequired, transaction: PropTypes.shape({ data: PropTypes.string, from: PropTypes.string.isRequired, gas: PropTypes.object.isRequired, gasPrice: PropTypes.object.isRequired, to: PropTypes.string, value: PropTypes.object.isRequired }).isRequired }; static defaultProps = { focus: false }; gasStore = new GasPriceEditor.Store(this.context.api, { gas: this.props.transaction.gas.toFixed(), gasLimit: this.props.gasLimit, gasPrice: this.props.transaction.gasPrice.toFixed() }); componentWillMount () { const { store, transaction } = this.props; const { from, gas, gasPrice, to, value } = transaction; const fee = tUtil.getFee(gas, gasPrice); // BigNumber object const gasPriceEthmDisplay = tUtil.getEthmFromWeiDisplay(gasPrice); const gasToDisplay = tUtil.getGasDisplay(gas); const totalValue = tUtil.getTotalValue(fee, value); this.setState({ gasPriceEthmDisplay, totalValue, gasToDisplay }); this.gasStore.setEthValue(value); store.fetchBalances([from, to]); } render () { return this.gasStore.isEditing ? this.renderGasEditor() : this.renderTransaction(); } renderTransaction () { const { className, focus, id, isSending, isTest, store, transaction } = this.props; const { totalValue } = this.state; const { from, value } = transaction; const fromBalance = store.balances[from]; return ( <div className={ `${styles.container} ${className}` }> <TransactionMainDetails<|fim▁hole|> id={ id } isTest={ isTest } totalValue={ totalValue } transaction={ transaction } value={ value } /> <TransactionPendingForm address={ from } focus={ focus } isSending={ isSending } onConfirm={ this.onConfirm } onReject={ this.onReject } /> </div> ); } renderGasEditor () { const { className } = this.props; return ( <div className={ `${styles.container} ${className}` }> <GasPriceEditor store={ this.gasStore }> <Button label='view transaction' onClick={ this.toggleGasEditor } /> </GasPriceEditor> </div> ); } onConfirm = (data) => { const { id, transaction } = this.props; const { password, wallet } = data; const { gas, gasPrice } = this.gasStore.overrideTransaction(transaction); this.props.onConfirm({ gas, gasPrice, id, password, wallet }); } onReject = () => { this.props.onReject(this.props.id); } toggleGasEditor = () => { this.gasStore.setEditing(false); } }<|fim▁end|>
className={ styles.transactionDetails } from={ from } fromBalance={ fromBalance } gasStore={ this.gasStore }
<|file_name|>common.go<|end_file_name|><|fim▁begin|>// Copyright 2014 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // The go-ethereum library 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. package vm import ( "github.com/expanse-org/go-expanse/common" "github.com/expanse-org/go-expanse/common/math" "github.com/holiman/uint256" ) // calcMemSize64 calculates the required memory size, and returns // the size and whether the result overflowed uint64 func calcMemSize64(off, l *uint256.Int) (uint64, bool) { if !l.IsUint64() { return 0, true } return calcMemSize64WithUint(off, l.Uint64()) } // calcMemSize64WithUint calculates the required memory size, and returns // the size and whether the result overflowed uint64 // Identical to calcMemSize64, but length is a uint64 func calcMemSize64WithUint(off *uint256.Int, length64 uint64) (uint64, bool) { // if length is zero, memsize is always zero, regardless of offset if length64 == 0 { return 0, false } // Check that offset doesn't overflow offset64, overflow := off.Uint64WithOverflow() if overflow { return 0, true } val := offset64 + length64 // if value < either of it's parts, then it overflowed return val, val < offset64 } // getData returns a slice from the data based on the start and size and pads // up to size with zero's. This function is overflow safe. func getData(data []byte, start uint64, size uint64) []byte {<|fim▁hole|> } end := start + size if end > length { end = length } return common.RightPadBytes(data[start:end], int(size)) } // toWordSize returns the ceiled word size required for memory expansion. func toWordSize(size uint64) uint64 { if size > math.MaxUint64-31 { return math.MaxUint64/32 + 1 } return (size + 31) / 32 } func allZero(b []byte) bool { for _, byte := range b { if byte != 0 { return false } } return true }<|fim▁end|>
length := uint64(len(data)) if start > length { start = length
<|file_name|>playwire.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- import re,urlparse,json from liveresolver.modules import client from BeautifulSoup import BeautifulSoup as bs import xbmcgui def resolve(url): try: result = client.request(url) html = result result = json.loads(result) try: f4m=result['content']['media']['f4m'] except: reg=re.compile('"src":"http://(.+?).f4m"') f4m=re.findall(reg,html)[0] f4m='http://'+pom+'.f4m' result = client.request(f4m) soup = bs(result) try: base=soup.find('baseURL').getText()+'/' except: base=soup.find('baseurl').getText()+'/' linklist = soup.findAll('media') choices,links=[],[] for link in linklist: <|fim▁hole|> choices.append(bitrate) links.append(url) if len(links)==1: return links[0] if len(links)>1: dialog = xbmcgui.Dialog() index = dialog.select('Select bitrate', choices) if index>-1: return links[index] return except: return<|fim▁end|>
url = base + link['url'] bitrate = link['bitrate']
<|file_name|>HelloWorld.java<|end_file_name|><|fim▁begin|>/** * Copyright (c) 2010 RedEngine Ltd, http://www.redengine.co.nz. All rights reserved. *<|fim▁hole|> * * Unless required by applicable law or agreed to in writing, * software distributed under the Apache License Version 2.0 is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. */ package net.stickycode.deploy.sample.helloworld; public class HelloWorld implements Runnable { public void hello() { System.out.println("Hello World!"); } @Override public void run() { System.out.println("Hello Embedded World!"); try { Thread.sleep(5000); } catch (InterruptedException e) { throw new RuntimeException(e); } } }<|fim▁end|>
* This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
<|file_name|>nom.rs<|end_file_name|><|fim▁begin|>//! Useful parser combinators //! //! A number of useful parser combinators have already been implemented. //! Some of them use macros, other are implemented through functions. //! Hopefully, the syntax will converge to onely one way in the future, //! but the macros system makes no promises. //! #[cfg(feature = "core")] use std::prelude::v1::*; use std::boxed::Box; use std::fmt::Debug; use internal::*; use internal::IResult::*; use internal::Err::*; use util::{ErrorKind,IterIndices,AsChar,InputLength}; use std::mem::transmute; #[inline] pub fn tag_cl<'a,'b>(rec:&'a[u8]) -> Box<Fn(&'b[u8]) -> IResult<&'b[u8], &'b[u8]> + 'a> { Box::new(move |i: &'b[u8]| -> IResult<&'b[u8], &'b[u8]> { if i.len() >= rec.len() && &i[0..rec.len()] == rec { Done(&i[rec.len()..], &i[0..rec.len()]) } else { Error(Position(ErrorKind::TagClosure, i)) } }) } #[cfg(not(feature = "core"))] #[inline] pub fn print<T: Debug>(input: T) -> IResult<T, ()> { println!("{:?}", input); Done(input, ()) } #[inline] pub fn begin(input: &[u8]) -> IResult<(), &[u8]> { Done((), input) } // FIXME: when rust-lang/rust#17436 is fixed, macros will be able to export // public methods //pub is_not!(line_ending b"\r\n") pub fn not_line_ending(input:&[u8]) -> IResult<&[u8], &[u8]> { for (idx, item) in input.iter().enumerate() { for &i in b"\r\n".iter() { if *item == i { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input.len()..], input) } named!(tag_ln, tag!("\n")); /// Recognizes a line feed #[inline] pub fn line_ending(input:&[u8]) -> IResult<&[u8], &[u8]> { tag_ln(input) } #[inline] pub fn is_alphabetic(chr:u8) -> bool { (chr >= 0x41 && chr <= 0x5A) || (chr >= 0x61 && chr <= 0x7A) } #[inline] pub fn is_digit(chr: u8) -> bool { chr >= 0x30 && chr <= 0x39 } #[inline] pub fn is_hex_digit(chr: u8) -> bool { (chr >= 0x30 && chr <= 0x39) || (chr >= 0x41 && chr <= 0x46) || (chr >= 0x61 && chr <= 0x66) } #[inline] pub fn is_oct_digit(chr: u8) -> bool { chr >= 0x30 && chr <= 0x37 } #[inline] pub fn is_alphanumeric(chr: u8) -> bool { is_alphabetic(chr) || is_digit(chr) } #[inline] pub fn is_space(chr:u8) -> bool { chr == ' ' as u8 || chr == '\t' as u8 } // FIXME: when rust-lang/rust#17436 is fixed, macros will be able to export //pub filter!(alpha is_alphabetic) //pub filter!(digit is_digit) //pub filter!(hex_digit is_hex_digit) //pub filter!(oct_digit is_oct_digit) //pub filter!(alphanumeric is_alphanumeric) use std::ops::{Index,Range,RangeFrom}; /// Recognizes lowercase and uppercase alphabetic characters: a-zA-Z pub fn alpha<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::Alpha, input)) } for (idx, item) in input.iter_indices() { if ! item.is_alpha() { if idx == 0 { return Error(Position(ErrorKind::Alpha, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } /// Recognizes numerical characters: 0-9 pub fn digit<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::Digit, input)) } for (idx, item) in input.iter_indices() { if ! item.is_0_to_9() { if idx == 0 { return Error(Position(ErrorKind::Digit, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } /// Recognizes hexadecimal numerical characters: 0-9, A-F, a-f pub fn hex_digit<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::HexDigit, input)) } for (idx, item) in input.iter_indices() { if ! item.is_hex_digit() { if idx == 0 { return Error(Position(ErrorKind::HexDigit, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } /// Recognizes octal characters: 0-7 pub fn oct_digit<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::OctDigit, input)) } for (idx, item) in input.iter_indices() { if ! item.is_oct_digit() { if idx == 0 { return Error(Position(ErrorKind::OctDigit, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } /// Recognizes numerical and alphabetic characters: 0-9a-zA-Z pub fn alphanumeric<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::AlphaNumeric, input)); } for (idx, item) in input.iter_indices() { if ! item.is_alphanum() { if idx == 0 { return Error(Position(ErrorKind::AlphaNumeric, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } /// Recognizes spaces and tabs pub fn space<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::Space, input)); } for (idx, item) in input.iter_indices() { let chr = item.as_char(); if ! (chr == ' ' || chr == '\t') { if idx == 0 { return Error(Position(ErrorKind::Space, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } /// Recognizes spaces, tabs, carriage returns and line feeds pub fn multispace<'a, T: ?Sized>(input:&'a T) -> IResult<&'a T, &'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: IterIndices+InputLength { let input_length = input.input_len(); if input_length == 0 { return Error(Position(ErrorKind::MultiSpace, input)); } for (idx, item) in input.iter_indices() { let chr = item.as_char(); if ! (chr == ' ' || chr == '\t' || chr == '\r' || chr == '\n') { if idx == 0 { return Error(Position(ErrorKind::MultiSpace, input)) } else { return Done(&input[idx..], &input[0..idx]) } } } Done(&input[input_length..], input) } pub fn sized_buffer(input:&[u8]) -> IResult<&[u8], &[u8]> { if input.is_empty() { return Incomplete(Needed::Unknown) } let len = input[0] as usize; if input.len() >= len + 1 { Done(&input[len+1..], &input[1..len+1]) } else { Incomplete(Needed::Size(1 + len)) } } pub fn length_value(input:&[u8]) -> IResult<&[u8], &[u8]> { let input_len = input.len(); if input_len == 0 { return Error(Position(ErrorKind::LengthValueFn, input)) } let len = input[0] as usize; if input_len - 1 >= len { IResult::Done(&input[len+1..], &input[1..len+1]) } else { IResult::Incomplete(Needed::Size(1+len)) } } /// Recognizes an unsigned 1 byte integer (equivalent to take!(1) #[inline] pub fn be_u8(i: &[u8]) -> IResult<&[u8], u8> { if i.len() < 1 { Incomplete(Needed::Size(1)) } else { Done(&i[1..], i[0]) } } /// Recognizes big endian unsigned 2 bytes integer #[inline] pub fn be_u16(i: &[u8]) -> IResult<&[u8], u16> { if i.len() < 2 { Incomplete(Needed::Size(2)) } else { let res = ((i[0] as u16) << 8) + i[1] as u16; Done(&i[2..], res) } } /// Recognizes big endian unsigned 4 bytes integer #[inline] pub fn be_u32(i: &[u8]) -> IResult<&[u8], u32> { if i.len() < 4 { Incomplete(Needed::Size(4)) } else { let res = ((i[0] as u32) << 24) + ((i[1] as u32) << 16) + ((i[2] as u32) << 8) + i[3] as u32; Done(&i[4..], res) } } /// Recognizes big endian unsigned 8 bytes integer #[inline] pub fn be_u64(i: &[u8]) -> IResult<&[u8], u64> { if i.len() < 8 { Incomplete(Needed::Size(8)) } else { let res = ((i[0] as u64) << 56) + ((i[1] as u64) << 48) + ((i[2] as u64) << 40) + ((i[3] as u64) << 32) + ((i[4] as u64) << 24) + ((i[5] as u64) << 16) + ((i[6] as u64) << 8) + i[7] as u64; Done(&i[8..], res) } } /// Recognizes a signed 1 byte integer (equivalent to take!(1) #[inline] pub fn be_i8(i:&[u8]) -> IResult<&[u8], i8> { map!(i, be_u8, | x | { x as i8 }) } /// Recognizes big endian signed 2 bytes integer #[inline] pub fn be_i16(i:&[u8]) -> IResult<&[u8], i16> { map!(i, be_u16, | x | { x as i16 }) } /// Recognizes big endian signed 4 bytes integer #[inline] pub fn be_i32(i:&[u8]) -> IResult<&[u8], i32> { map!(i, be_u32, | x | { x as i32 }) } /// Recognizes big endian signed 8 bytes integer #[inline] pub fn be_i64(i:&[u8]) -> IResult<&[u8], i64> { map!(i, be_u64, | x | { x as i64 }) } /// Recognizes an unsigned 1 byte integer (equivalent to take!(1) #[inline] pub fn le_u8(i: &[u8]) -> IResult<&[u8], u8> { if i.len() < 1 { Incomplete(Needed::Size(1)) } else { Done(&i[1..], i[0]) } } /// Recognizes little endian unsigned 2 bytes integer #[inline] pub fn le_u16(i: &[u8]) -> IResult<&[u8], u16> { if i.len() < 2 { Incomplete(Needed::Size(2)) } else { let res = ((i[1] as u16) << 8) + i[0] as u16; Done(&i[2..], res) } } /// Recognizes little endian unsigned 4 bytes integer #[inline] pub fn le_u32(i: &[u8]) -> IResult<&[u8], u32> { if i.len() < 4 { Incomplete(Needed::Size(4)) } else { let res = ((i[3] as u32) << 24) + ((i[2] as u32) << 16) + ((i[1] as u32) << 8) + i[0] as u32; Done(&i[4..], res) } } /// Recognizes little endian unsigned 8 bytes integer #[inline] pub fn le_u64(i: &[u8]) -> IResult<&[u8], u64> { if i.len() < 8 { Incomplete(Needed::Size(8)) } else { let res = ((i[7] as u64) << 56) + ((i[6] as u64) << 48) + ((i[5] as u64) << 40) + ((i[4] as u64) << 32) + ((i[3] as u64) << 24) + ((i[2] as u64) << 16) + ((i[1] as u64) << 8) + i[0] as u64; Done(&i[8..], res) } } /// Recognizes a signed 1 byte integer (equivalent to take!(1) #[inline] pub fn le_i8(i:&[u8]) -> IResult<&[u8], i8> { map!(i, le_u8, | x | { x as i8 }) } /// Recognizes little endian signed 2 bytes integer #[inline] pub fn le_i16(i:&[u8]) -> IResult<&[u8], i16> { map!(i, le_u16, | x | { x as i16 }) } /// Recognizes little endian signed 4 bytes integer #[inline] pub fn le_i32(i:&[u8]) -> IResult<&[u8], i32> { map!(i, le_u32, | x | { x as i32 }) } /// Recognizes little endian signed 8 bytes integer #[inline] pub fn le_i64(i:&[u8]) -> IResult<&[u8], i64> { map!(i, le_u64, | x | { x as i64 }) } /// if parameter is true, parse a big endian u16 integer, /// otherwise a little endian u16 integer #[macro_export] macro_rules! u16 ( ($i:expr, $e:expr) => ( {if $e { $crate::be_u16($i) } else { $crate::le_u16($i) } } );); /// if parameter is true, parse a big endian u32 integer, /// otherwise a little endian u32 integer #[macro_export] macro_rules! u32 ( ($i:expr, $e:expr) => ( {if $e { $crate::be_u32($i) } else { $crate::le_u32($i) } } );); /// if parameter is true, parse a big endian u64 integer, /// otherwise a little endian u64 integer #[macro_export] macro_rules! u64 ( ($i:expr, $e:expr) => ( {if $e { $crate::be_u64($i) } else { $crate::le_u64($i) } } );); /// if parameter is true, parse a big endian i16 integer, /// otherwise a little endian i16 integer #[macro_export] macro_rules! i16 ( ($i:expr, $e:expr) => ( {if $e { $crate::be_i16($i) } else { $crate::le_i16($i) } } ););<|fim▁hole|>#[macro_export] macro_rules! i32 ( ($i:expr, $e:expr) => ( {if $e { $crate::be_i32($i) } else { $crate::le_i32($i) } } );); /// if parameter is true, parse a big endian i64 integer, /// otherwise a little endian i64 integer #[macro_export] macro_rules! i64 ( ($i:expr, $e:expr) => ( {if $e { $crate::be_i64($i) } else { $crate::le_i64($i) } } );); /// Recognizes big endian 4 bytes floating point number #[inline] pub fn be_f32(input: &[u8]) -> IResult<&[u8], f32> { match be_u32(input) { Error(e) => Error(e), Incomplete(e) => Incomplete(e), Done(i,o) => { unsafe { Done(i, transmute::<u32, f32>(o)) } } } } /// Recognizes big endian 8 bytes floating point number #[inline] pub fn be_f64(input: &[u8]) -> IResult<&[u8], f64> { match be_u64(input) { Error(e) => Error(e), Incomplete(e) => Incomplete(e), Done(i,o) => { unsafe { Done(i, transmute::<u64, f64>(o)) } } } } /// Recognizes a hex-encoded integer #[inline] pub fn hex_u32(input: &[u8]) -> IResult<&[u8], u32> { match is_a!(input, &b"0123456789abcdef"[..]) { Error(e) => Error(e), Incomplete(e) => Incomplete(e), Done(i,o) => { let mut res = 0u32; // Do not parse more than 8 characters for a u32 let mut remaining = i; let mut parsed = o; if o.len() > 8 { remaining = &input[8..]; parsed = &input[..8]; } for &e in parsed { let digit = e as char; let value = digit.to_digit(16).unwrap_or(0); res = value + (res << 4); } Done(remaining, res) } } } /// Recognizes empty input buffers /// /// useful to verify that the previous parsers used all of the input #[inline] //pub fn eof(input:&[u8]) -> IResult<&[u8], &[u8]> { pub fn eof<'a, T:?Sized>(input: &'a T) -> IResult<&'a T,&'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: InputLength { if input.input_len() == 0 { Done(input, input) } else { Error(Position(ErrorKind::Eof, input)) } } /// Recognizes non empty buffers #[inline] pub fn non_empty<'a, T:?Sized>(input: &'a T) -> IResult<&'a T,&'a T> where T:Index<Range<usize>, Output=T>+Index<RangeFrom<usize>, Output=T>, &'a T: InputLength { if input.input_len() == 0 { Error(Position(ErrorKind::NonEmpty, input)) } else { Done(&input[input.input_len()..], input) } } /// Return the remaining input. #[inline] pub fn rest(input: &[u8]) -> IResult<&[u8], &[u8]> { IResult::Done(&input[input.len()..], input) } #[cfg(test)] mod tests { use super::*; use internal::{Needed,IResult}; use internal::IResult::*; use internal::Err::*; use util::ErrorKind; #[test] fn tag_closure() { let x = tag_cl(&b"abcd"[..]); let r = x(&b"abcdabcdefgh"[..]); assert_eq!(r, Done(&b"abcdefgh"[..], &b"abcd"[..])); let r2 = x(&b"abcefgh"[..]); assert_eq!(r2, Error(Position(ErrorKind::TagClosure, &b"abcefgh"[..]))); } #[test] fn character() { let empty: &[u8] = b""; let a: &[u8] = b"abcd"; let b: &[u8] = b"1234"; let c: &[u8] = b"a123"; let d: &[u8] = "azé12".as_bytes(); let e: &[u8] = b" "; assert_eq!(alpha(a), Done(empty, a)); assert_eq!(alpha(b), Error(Position(ErrorKind::Alpha,b))); assert_eq!(alpha(c), Done(&c[1..], &b"a"[..])); assert_eq!(alpha(d), Done("é12".as_bytes(), &b"az"[..])); assert_eq!(digit(a), Error(Position(ErrorKind::Digit,a))); assert_eq!(digit(b), Done(empty, b)); assert_eq!(digit(c), Error(Position(ErrorKind::Digit,c))); assert_eq!(digit(d), Error(Position(ErrorKind::Digit,d))); assert_eq!(hex_digit(a), Done(empty, a)); assert_eq!(hex_digit(b), Done(empty, b)); assert_eq!(hex_digit(c), Done(empty, c)); assert_eq!(hex_digit(d), Done("zé12".as_bytes(), &b"a"[..])); assert_eq!(hex_digit(e), Error(Position(ErrorKind::HexDigit,e))); assert_eq!(oct_digit(a), Error(Position(ErrorKind::OctDigit,a))); assert_eq!(oct_digit(b), Done(empty, b)); assert_eq!(oct_digit(c), Error(Position(ErrorKind::OctDigit,c))); assert_eq!(oct_digit(d), Error(Position(ErrorKind::OctDigit,d))); assert_eq!(alphanumeric(a), Done(empty, a)); assert_eq!(fix_error!(b,(), alphanumeric), Done(empty, b)); assert_eq!(alphanumeric(c), Done(empty, c)); assert_eq!(alphanumeric(d), Done("é12".as_bytes(), &b"az"[..])); assert_eq!(space(e), Done(&b""[..], &b" "[..])); } #[test] fn character_s() { let empty = ""; let a = "abcd"; let b = "1234"; let c = "a123"; let d = "azé12"; let e = " "; assert_eq!(alpha(a), Done(empty, a)); assert_eq!(alpha(b), Error(Position(ErrorKind::Alpha,b))); assert_eq!(alpha(c), Done(&c[1..], &"a"[..])); assert_eq!(alpha(d), Done("12", &"azé"[..])); assert_eq!(digit(a), Error(Position(ErrorKind::Digit,a))); assert_eq!(digit(b), Done(empty, b)); assert_eq!(digit(c), Error(Position(ErrorKind::Digit,c))); assert_eq!(digit(d), Error(Position(ErrorKind::Digit,d))); assert_eq!(hex_digit(a), Done(empty, a)); assert_eq!(hex_digit(b), Done(empty, b)); assert_eq!(hex_digit(c), Done(empty, c)); assert_eq!(hex_digit(d), Done("zé12", &"a"[..])); assert_eq!(hex_digit(e), Error(Position(ErrorKind::HexDigit,e))); assert_eq!(oct_digit(a), Error(Position(ErrorKind::OctDigit,a))); assert_eq!(oct_digit(b), Done(empty, b)); assert_eq!(oct_digit(c), Error(Position(ErrorKind::OctDigit,c))); assert_eq!(oct_digit(d), Error(Position(ErrorKind::OctDigit,d))); assert_eq!(alphanumeric(a), Done(empty, a)); assert_eq!(fix_error!(b,(), alphanumeric), Done(empty, b)); assert_eq!(alphanumeric(c), Done(empty, c)); assert_eq!(alphanumeric(d), Done("", &"azé12"[..])); assert_eq!(space(e), Done(&""[..], &" "[..])); } use util::HexDisplay; #[test] fn offset() { let a = &b"abcd"[..]; let b = &b"1234"[..]; let c = &b"a123"[..]; let d = &b" \t"[..]; let e = &b" \t\r\n"[..]; let f = &b"123abcDEF"[..]; match alpha(a) { Done(i, _) => { assert_eq!(a.offset(i) + i.len(), a.len()); } _ => { panic!("wrong return type in offset test for alpha") } } match digit(b) { Done(i, _) => { assert_eq!(b.offset(i) + i.len(), b.len()); } _ => { panic!("wrong return type in offset test for digit") } } match alphanumeric(c) { Done(i, _) => { assert_eq!(c.offset(i) + i.len(), c.len()); } _ => { panic!("wrong return type in offset test for alphanumeric") } } match space(d) { Done(i, _) => { assert_eq!(d.offset(i) + i.len(), d.len()); } _ => { panic!("wrong return type in offset test for space") } } match multispace(e) { Done(i, _) => { assert_eq!(e.offset(i) + i.len(), e.len()); } _ => { panic!("wrong return type in offset test for multispace") } } match hex_digit(f) { Done(i, _) => { assert_eq!(f.offset(i) + i.len(), f.len()); } _ => { panic!("wrong return type in offset test for hex_digit") } } match oct_digit(f) { Done(i, _) => { assert_eq!(f.offset(i) + i.len(), f.len()); } _ => { panic!("wrong return type in offset test for oct_digit") } } } #[test] fn is_not() { let a: &[u8] = b"ab12cd\nefgh"; assert_eq!(not_line_ending(a), Done(&b"\nefgh"[..], &b"ab12cd"[..])); let b: &[u8] = b"ab12cd\nefgh\nijkl"; assert_eq!(not_line_ending(b), Done(&b"\nefgh\nijkl"[..], &b"ab12cd"[..])); let c: &[u8] = b"ab12cd"; assert_eq!(not_line_ending(c), Done(&b""[..], c)); } #[test] fn buffer_with_size() { let i:Vec<u8> = vec![7,8]; let o:Vec<u8> = vec![4,5,6]; //let arr:[u8; 6usize] = [3, 4, 5, 6, 7, 8]; let arr:[u8; 6usize] = [3, 4, 5, 6, 7, 8]; let res = sized_buffer(&arr[..]); assert_eq!(res, Done(&i[..], &o[..])) } /*#[test] fn t1() { let v1:Vec<u8> = vec![1,2,3]; let v2:Vec<u8> = vec![4,5,6]; let d = Done(&v1[..], &v2[..]); let res = d.flat_map(print); assert_eq!(res, Done(&v2[..], ())); }*/ #[test] fn length_value_test() { let i1 = vec![7,8]; let o1 = vec![4, 5, 6]; let arr1:[u8; 6usize] = [3, 4, 5, 6, 7, 8]; let res1 = length_value(&arr1); assert_eq!(Done(&i1[..], &o1[..]), res1); let i2:Vec<u8> = vec![4,5,6,7,8]; let o2: &[u8] = b""; let arr2:[u8; 6usize] = [0, 4, 5, 6, 7, 8]; let res2 = length_value(&arr2); assert_eq!(Done(&i2[..], o2), res2); let arr3:[u8; 7usize] = [8, 4, 5, 6, 7, 8, 9]; let res3 = length_value(&arr3); //FIXME: should be incomplete assert_eq!(Incomplete(Needed::Size(9)), res3); } #[test] fn i8_tests() { assert_eq!(be_i8(&[0x00]), Done(&b""[..], 0)); assert_eq!(be_i8(&[0x7f]), Done(&b""[..], 127)); assert_eq!(be_i8(&[0xff]), Done(&b""[..], -1)); assert_eq!(be_i8(&[0x80]), Done(&b""[..], -128)); } #[test] fn i16_tests() { assert_eq!(be_i16(&[0x00, 0x00]), Done(&b""[..], 0)); assert_eq!(be_i16(&[0x7f, 0xff]), Done(&b""[..], 32767_i16)); assert_eq!(be_i16(&[0xff, 0xff]), Done(&b""[..], -1)); assert_eq!(be_i16(&[0x80, 0x00]), Done(&b""[..], -32768_i16)); } #[test] fn i32_tests() { assert_eq!(be_i32(&[0x00, 0x00, 0x00, 0x00]), Done(&b""[..], 0)); assert_eq!(be_i32(&[0x7f, 0xff, 0xff, 0xff]), Done(&b""[..], 2147483647_i32)); assert_eq!(be_i32(&[0xff, 0xff, 0xff, 0xff]), Done(&b""[..], -1)); assert_eq!(be_i32(&[0x80, 0x00, 0x00, 0x00]), Done(&b""[..], -2147483648_i32)); } #[test] fn i64_tests() { assert_eq!(be_i64(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), Done(&b""[..], 0)); assert_eq!(be_i64(&[0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]), Done(&b""[..], 9223372036854775807_i64)); assert_eq!(be_i64(&[0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]), Done(&b""[..], -1)); assert_eq!(be_i64(&[0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), Done(&b""[..], -9223372036854775808_i64)); } #[test] fn le_i8_tests() { assert_eq!(le_i8(&[0x00]), Done(&b""[..], 0)); assert_eq!(le_i8(&[0x7f]), Done(&b""[..], 127)); assert_eq!(le_i8(&[0xff]), Done(&b""[..], -1)); assert_eq!(le_i8(&[0x80]), Done(&b""[..], -128)); } #[test] fn le_i16_tests() { assert_eq!(le_i16(&[0x00, 0x00]), Done(&b""[..], 0)); assert_eq!(le_i16(&[0xff, 0x7f]), Done(&b""[..], 32767_i16)); assert_eq!(le_i16(&[0xff, 0xff]), Done(&b""[..], -1)); assert_eq!(le_i16(&[0x00, 0x80]), Done(&b""[..], -32768_i16)); } #[test] fn le_i32_tests() { assert_eq!(le_i32(&[0x00, 0x00, 0x00, 0x00]), Done(&b""[..], 0)); assert_eq!(le_i32(&[0xff, 0xff, 0xff, 0x7f]), Done(&b""[..], 2147483647_i32)); assert_eq!(le_i32(&[0xff, 0xff, 0xff, 0xff]), Done(&b""[..], -1)); assert_eq!(le_i32(&[0x00, 0x00, 0x00, 0x80]), Done(&b""[..], -2147483648_i32)); } #[test] fn le_i64_tests() { assert_eq!(le_i64(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), Done(&b""[..], 0)); assert_eq!(le_i64(&[0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f]), Done(&b""[..], 9223372036854775807_i64)); assert_eq!(le_i64(&[0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]), Done(&b""[..], -1)); assert_eq!(le_i64(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80]), Done(&b""[..], -9223372036854775808_i64)); } #[test] fn hex_u32_tests() { assert_eq!(hex_u32(&b""[..]), Done(&b""[..], 0)); assert_eq!(hex_u32(&b"ff"[..]), Done(&b""[..], 255)); assert_eq!(hex_u32(&b"1be2"[..]), Done(&b""[..], 7138)); assert_eq!(hex_u32(&b"c5a31be2"[..]), Done(&b""[..], 3315801058)); assert_eq!(hex_u32(&b"00c5a31be2"[..]), Done(&b"e2"[..], 12952347)); assert_eq!(hex_u32(&b"c5a31be201"[..]), Done(&b"01"[..], 3315801058)); assert_eq!(hex_u32(&b"ffffffff"[..]), Done(&b""[..], 4294967295)); assert_eq!(hex_u32(&b"0x1be2"[..]), Done(&b"x1be2"[..], 0)); } #[test] fn end_of_input() { let not_over = &b"Hello, world!"[..]; let is_over = &b""[..]; let res_not_over = eof(not_over); assert_eq!(res_not_over, Error(Position(ErrorKind::Eof, not_over))); let res_over = eof(is_over); assert_eq!(res_over, Done(is_over, is_over)); } #[test] fn configurable_endianness() { named!(be_tst16<u16>, u16!(true)); named!(le_tst16<u16>, u16!(false)); assert_eq!(be_tst16(&[0x80, 0x00]), Done(&b""[..], 32768_u16)); assert_eq!(le_tst16(&[0x80, 0x00]), Done(&b""[..], 128_u16)); named!(be_tst32<u32>, u32!(true)); named!(le_tst32<u32>, u32!(false)); assert_eq!(be_tst32(&[0x12, 0x00, 0x60, 0x00]), Done(&b""[..], 302014464_u32)); assert_eq!(le_tst32(&[0x12, 0x00, 0x60, 0x00]), Done(&b""[..], 6291474_u32)); named!(be_tst64<u64>, u64!(true)); named!(le_tst64<u64>, u64!(false)); assert_eq!(be_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]), Done(&b""[..], 1297142246100992000_u64)); assert_eq!(le_tst64(&[0x12, 0x00, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]), Done(&b""[..], 36028874334666770_u64)); named!(be_tsti16<i16>, i16!(true)); named!(le_tsti16<i16>, i16!(false)); assert_eq!(be_tsti16(&[0x00, 0x80]), Done(&b""[..], 128_i16)); assert_eq!(le_tsti16(&[0x00, 0x80]), Done(&b""[..], -32768_i16)); named!(be_tsti32<i32>, i32!(true)); named!(le_tsti32<i32>, i32!(false)); assert_eq!(be_tsti32(&[0x00, 0x12, 0x60, 0x00]), Done(&b""[..], 1204224_i32)); assert_eq!(le_tsti32(&[0x00, 0x12, 0x60, 0x00]), Done(&b""[..], 6296064_i32)); named!(be_tsti64<i64>, i64!(true)); named!(le_tsti64<i64>, i64!(false)); assert_eq!(be_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]), Done(&b""[..], 71881672479506432_i64)); assert_eq!(le_tsti64(&[0x00, 0xFF, 0x60, 0x00, 0x12, 0x00, 0x80, 0x00]), Done(&b""[..], 36028874334732032_i64)); } #[test] fn manual_configurable_endianness_test() { let x = 1; let int_parse: Box<Fn(&[u8]) -> IResult<&[u8], u16> > = if x == 2 { Box::new(be_u16) } else { Box::new(le_u16) }; println!("{:?}", int_parse(&b"3"[..])); assert_eq!(int_parse(&[0x80, 0x00]), Done(&b""[..], 128_u16)); } #[allow(dead_code)] fn custom_error(input: &[u8]) -> IResult<&[u8], &[u8], ()> { fix_error!(input, (), alphanumeric) } #[test] fn hex_digit_test() { let empty = &b""[..]; let i = &b"0123456789abcdefABCDEF"[..]; assert_eq!(hex_digit(i), Done(empty, i)); let i = &b"g"[..]; assert_eq!(hex_digit(i), Error(Position(ErrorKind::HexDigit,i))); let i = &b"G"[..]; assert_eq!(hex_digit(i), Error(Position(ErrorKind::HexDigit,i))); assert!(is_hex_digit(b'0')); assert!(is_hex_digit(b'9')); assert!(is_hex_digit(b'a')); assert!(is_hex_digit(b'f')); assert!(is_hex_digit(b'A')); assert!(is_hex_digit(b'F')); assert!(!is_hex_digit(b'g')); assert!(!is_hex_digit(b'G')); assert!(!is_hex_digit(b'/')); assert!(!is_hex_digit(b':')); assert!(!is_hex_digit(b'@')); assert!(!is_hex_digit(b'\x60')); } #[test] fn oct_digit_test() { let empty = &b""[..]; let i = &b"01234567"[..]; assert_eq!(oct_digit(i), Done(empty, i)); let i = &b"8"[..]; assert_eq!(oct_digit(i), Error(Position(ErrorKind::OctDigit,i))); assert!(is_oct_digit(b'0')); assert!(is_oct_digit(b'7')); assert!(!is_oct_digit(b'8')); assert!(!is_oct_digit(b'9')); assert!(!is_oct_digit(b'a')); assert!(!is_oct_digit(b'A')); assert!(!is_oct_digit(b'/')); assert!(!is_oct_digit(b':')); assert!(!is_oct_digit(b'@')); assert!(!is_oct_digit(b'\x60')); } }<|fim▁end|>
/// if parameter is true, parse a big endian i32 integer, /// otherwise a little endian i32 integer
<|file_name|>Multiples_of_3_and_5.py<|end_file_name|><|fim▁begin|>#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. #Find the sum of all the multiples of 3 or 5 below 1000. <|fim▁hole|><|fim▁end|>
print sum([x for x in xrange(1,1000) if (x % 3 == 0) or (x % 5 == 0)])
<|file_name|>result-types.rs<|end_file_name|><|fim▁begin|><|fim▁hole|> // === CDB TESTS ================================================================================== // cdb-command: g // cdb-command: dx x,d // cdb-check:x,d : Ok [Type: enum$<core::result::Result<i32,str> >] // cdb-check: [...] __0 : -3 [Type: int] // cdb-command: dx y // cdb-check:y : Err [Type: enum$<core::result::Result<i32,str> >] // cdb-check: [...] __0 : "Some error message" [Type: str] fn main() { let x: Result<i32, &str> = Ok(-3); assert_eq!(x.is_ok(), true); let y: Result<i32, &str> = Err("Some error message"); assert_eq!(y.is_ok(), false); zzz(); // #break. } fn zzz() { () }<|fim▁end|>
// cdb-only // min-cdb-version: 10.0.18317.1001 // compile-flags:-g
<|file_name|>sort.js<|end_file_name|><|fim▁begin|>'use strict'; function getReferenceMatrix (matrix, direction) { return matrix.unflatten().rows.sort((r1, r2) => { return (r1[1] > r2[1] ? 1 : r1[1] < r2[1] ? -1 : 0) * (direction === 'desc' ? -1 : 1); }); } function simpleSort (matrix, direction) { const referenceMatrix = getReferenceMatrix(matrix, direction); return matrix.clone({ axes: [ Object.assign({}, matrix.axes[0], {values: referenceMatrix.map(r => r[0])}) ], data: referenceMatrix.map(r => r[1]) }); } function complexSort () {//matrix, direction, strategy, dimension) { // const referenceMatrix = getReferenceMatrix(matrix.reduce(strategy, dimension), direction); } module.exports.ascending = function (strategy, dimension) { if (this.dimension === 1) { return simpleSort(this, 'asc'); } else if (this.dimension === 2) { throw new Error('Cannot sort tables of dimension greater than 1. It\'s on the todo list though!'); return complexSort(this, 'asc', strategy, dimension); } else { throw new Error('Cannot sort tables of dimesnion greater than 2'); } } module.exports.descending = function (strategy, dimension) { if (this.dimension === 1) { return simpleSort(this, 'desc'); } else if (this.dimension === 2) { throw new Error('Cannot sort tables of dimension greater than 1. It\'s on the todo list though!'); return complexSort(this, 'desc', strategy, dimension); } else { throw new Error('Cannot sort tables of dimesnion greater than 2'); } } function getReferenceMatrix (matrix, direction) { return matrix.unflatten().rows.sort((r1, r2) => { return (r1[1] > r2[1] ? 1 : r1[1] < r2[1] ? -1 : 0) * (direction === 'desc' ? -1 : 1); }); } function simpleSort (matrix, direction) { const referenceMatrix = getReferenceMatrix(matrix, direction); return matrix.clone({ axes: [ Object.assign({}, matrix.axes[0], {values: referenceMatrix.map(r => r[0])}) ], data: referenceMatrix.map(r => r[1]) }); } module.exports.property = function (prop) { const order = [].slice.call(arguments, 1); const dimension = this.getAxis(prop); if (dimension === -1) { throw new Error(`Attempting to do a custom sort on the property ${prop}, which doesn't exist`); } const originalValues = this.axes.find(a => a.property === prop).values; // this makes it easier to put the not found items last as the order // will go n = first, n-1 = second, ... , 0 = last, -1 = not found // we simply exchange 1 and -1 in the function below :o order.reverse(); const orderedValues = originalValues.slice().sort((v1, v2) => { const i1 = order.indexOf(v1);<|fim▁hole|> const newAxes = this.axes.slice(); newAxes[dimension] = Object.assign({}, this.axes[dimension], { values: orderedValues }); return this.clone({ axes: newAxes, data: Object.keys(this.data).reduce((obj, k) => { const coords = k.split(','); coords[dimension] = mapper[coords[dimension]]; obj[coords.join(',')] = this.data[k]; return obj; }, {}) }); }<|fim▁end|>
const i2 = order.indexOf(v2); return i1 > i2 ? -1 : i1 < i2 ? 1 : 0; }); const mapper = originalValues.map(v => orderedValues.indexOf(v))
<|file_name|>inc_trading.js<|end_file_name|><|fim▁begin|>function trading_init(){ if (!this.trading){ //if (this.trading === undefined || this.trading === null){ this.trading = apiNewOwnedDC(this); this.trading.label = 'Trading'; this.trading_create_escrow_bag(); this.trading.currants = 0; } var escrow = this.trading_get_escrow_bag(); if (!escrow){ this.trading_create_escrow_bag(); } else if (escrow.capacity != 6 && escrow.countContents() == 0){ escrow.apiDelete(); this.trading_create_escrow_bag(); } } function trading_create_escrow_bag(){ // Create a new private storage bag for holding items in escrow var it = apiNewItemStack('bag_escrow', 1); it.label = 'Private Trading Storage'; this.apiAddHiddenStack(it); this.trading.storage_tsid = it.tsid; } function trading_reset(){ this.trading_cancel_auto(); if (this.trading){ var escrow = this.trading_get_escrow_bag(); if (escrow){ var contents = escrow.getContents(); for (var i in contents){ if (contents[i]) contents[i].apiDelete(); } } } } function trading_delete(){ this.trading_cancel_auto(); if (this.trading){ var escrow = this.trading_get_escrow_bag(); if (escrow){ var contents = escrow.getContents(); for (var i in contents){ if (contents[i]) contents[i].apiDelete(); } escrow.apiDelete(); delete this.trading.storage_tsid; } this.trading.apiDelete(); delete this.trading; } } function trading_get_escrow_bag(){ return this.hiddenItems[this.trading.storage_tsid]; } function trading_has_escrow_items(){ var escrow = this.trading_get_escrow_bag(); return escrow.countContents() > 0 ? true : false; } // // Attempt to start a trade with player 'target_tsid' // function trading_request_start(target_tsid){ //log.info(this.tsid+' starting trade with '+target_tsid); this.trading_init(); // // Are we currently trading? // if (this['!is_trading']){ return { ok: 0, error: 'You are already trading with someone else. Finish that up first.' }; } // // Is there stuff in our escrow bag? // if (this.trading_has_escrow_items()){ return { ok: 0, error: 'You have unsettled items from a previous trade. Make some room in your pack for them before attempting another trade.' }; } // // Valid player? // if (target_tsid == this.tsid){ return { ok: 0, error: 'No trading with yourself.' }; } var target = getPlayer(target_tsid); if (!target){ return { ok: 0, error: 'Not a valid target player.' }; } if (this.buddies_is_ignored_by(target) || this.buddies_is_ignoring(target)){ return { ok: 0, error: 'You are blocking or blocked by that player.' }; } if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } if (target.getProp('location').tsid != this.location.tsid){ return { ok: 0, error: "Oh come on, they're not even in the same location as you!" }; } // // Are they currently trading? // if (target['!is_trading']){ target.sendOnlineActivity(this.label+' wanted to trade with you, but you are busy.'); return { ok: 0, error: 'That player is already trading with someone else. Please wait until they are done.' }; } // // Is there stuff in their escrow bag? // if (target.trading_has_escrow_items()){ target.sendOnlineActivity(this.label+' wanted to trade with you, but you have an unsettled previous trade.'); return { ok: 0, error: 'That player is not available for trading right now.' }; } <|fim▁hole|> // PROCEED // target.trading_init(); this['!is_trading'] = target.tsid; target['!is_trading'] = this.tsid; target.apiSendMsgAsIs({ type: 'trade_start', tsid: this.tsid }); // // Overlays // var anncx = { type: 'pc_overlay', duration: 0, pc_tsid: this.tsid, delta_x: 0, delta_y: -110, bubble: true, width: 70, height: 70, swf_url: overlay_key_to_url('trading'), uid: this.tsid+'_trading' }; this.location.apiSendAnnouncementX(anncx, this); anncx['pc_tsid'] = target.tsid; anncx['uid'] = target.tsid+'_trading'; target.location.apiSendAnnouncementX(anncx, target); return { ok: 1 }; } // // Cancel an in-progress trade with 'target_tsid' // function trading_cancel(target_tsid){ //log.info(this.tsid+' canceling trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); // // Roll back the trade on us and the target // this.trading_rollback(); if (target['!is_trading'] == this.tsid){ target.trading_rollback(); } // // Overlays // this.location.apiSendMsgAsIsX({ type: 'overlay_cancel', uid: this.tsid+'_trading' }, this); if (apiIsPlayerOnline(target_tsid) && target['!is_trading'] == this.tsid){ target.location.apiSendMsgAsIsX({ type: 'overlay_cancel', uid: target.tsid+'_trading' }, target); } // // Tell the other player // if (apiIsPlayerOnline(target_tsid) && target['!is_trading'] == this.tsid){ target.apiSendMsgAsIs({ type: 'trade_cancel', tsid: this.tsid }); target.prompts_add({ txt : this.label+" canceled their trade with you.", icon_buttons : false, timeout : 10, choices : [ { value : 'ok', label : 'Oh well' } ] }); } delete this['!is_trading']; if (target['!is_trading'] == this.tsid){ delete target['!is_trading']; } return { ok: 1 }; } function trading_rollback(){ //log.info(this.tsid+' rolling back trade'); // // Refund all the in-progress items // var escrow = this.trading_get_escrow_bag(); if (escrow){ var returned = []; var overflow = false; var contents = escrow.getContents(); for (var i in contents){ if (contents[i]){ var restore = escrow.removeItemStackSlot(i); var count = restore.count; var remaining = this.addItemStack(restore); if (remaining) overflow = true; if (remaining != count){ returned.push(pluralize(count-remaining, restore.name_single, restore.name_plural)); } } } if (overflow){ //log.info('trading_rollback overflow detected'); this.prompts_add({ txt : "Your magic rock is holding items from a previous trade for you. Make room in your pack to hold them.", icon_buttons : false, timeout : 30, choices : [ { value : 'ok', label : 'Very well' } ] }); this.trading_reorder_escrow(); } if (returned.length){ this.prompts_add({ txt : "Your "+pretty_list(returned, ' and ')+" "+(returned.length == 1 ? 'has' : 'have')+" been returned to you.", icon_buttons : false, timeout : 5, choices : [ { value : 'ok', label : 'OK' } ] }); } } // // Refund currants // if (this.trading.currants){ this.stats_add_currants(this.trading.currants); this.trading.currants = 0; } delete this['!trade_accepted']; } // // Cancel any in-progress trade // function trading_cancel_auto(){ //log.info(this.tsid+' canceling all trades'); if (this['!is_trading']) this.trading_cancel(this['!is_trading']); } // // Add an item to the trade // function trading_add_item(target_tsid, itemstack_tsid, amount){ //log.info(this.tsid+' adding item '+itemstack_tsid+' to trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } // // Get the item, put it in escrow // delete this['!trade_accepted']; delete target['!trade_accepted']; var ret = this.trading_add_item_do(itemstack_tsid, amount); if (!ret['ok']){ return ret; } // // Tell the other player // if (ret.item_class){ var rsp = { type: 'trade_add_item', tsid: this.tsid, itemstack_class: ret.item_class, amount: ret.count, slot: ret.slot, label: ret.label, config: ret.config }; if (ret.tool_state) rsp.tool_state = ret.tool_state; target.apiSendMsgAsIs(rsp); } return { ok: 1 }; } function trading_add_item_do(itemstack_tsid, amount, destination_slot){ //log.info('trading_add_item_do '+itemstack_tsid+' ('+amount+')'); var item = this.removeItemStackTsid(itemstack_tsid, amount); if (!item){ return { ok: 0, error: "That item is not in your possession." }; } var target = getPlayer(this['!is_trading']); if (!item.has_parent('furniture_base') && target.isBagFull(item)){ target.sendOnlineActivity(this.label+' tried to offer some '+item.label+' for trade, but you cannot hold it.'); this.items_put_back(item); return { ok: 0, error: "The other player cannot hold that item." }; } var item_class = item.class_tsid; var have_count = this.countItemClass(item_class); if (item.has_parent('furniture_base')){ have_count = this.furniture_get_bag().countItemClass(item_class); } // If this is a stack we split off from somewhere, we need to add it to the count if (!item.container) have_count += item.count; //log.info('trading_add_item_do have_count: '+have_count+', amount: '+amount); if (have_count < amount){ this.items_put_back(item); return { ok: 0, error: "You don't have enough of that item." }; } // // Some things are untradeable -- check them here // if (item.is_bag && item.countContents() > 0){ this.items_put_back(item); return { ok: 0, error: "You may not trade non-empty bags." }; } if (item.isSoulbound()){ this.items_put_back(item); return { ok: 0, error: "That item is locked to you, and can't be traded." }; } var escrow = this.trading_get_escrow_bag(); var slots = {}; var contents = escrow.getContents(); for (var i in contents){ if (contents[i]){ slots[i] = contents[i].count; } } var item_count = item.count; var remaining = escrow.addItemStack(item, destination_slot); if (remaining == item_count){ var restore = escrow.removeItemStackClass(item.class_tsid, remaining); this.items_put_back(item); this.addItemStack(restore); return { ok: 0, error: "Oops! We couldn't place that item in escrow." }; } if (item_count < amount){ var still_need = amount - item_count; do { var stack = this.removeItemStackClass(item_class, still_need); if (!stack){ return { ok: 0, error: "Oops! We couldn't place that item in escrow." }; } still_need -= stack.count; remaining = escrow.addItemStack(stack); if (remaining){ var restore = escrow.removeItemStackClass(item.class_tsid, remaining); this.items_put_back(stack); this.addItemStack(restore); return { ok: 0, error: "Oops! We couldn't place that item in escrow." }; } } while (still_need > 0); } // // Send changes // contents = escrow.getContents(); for (var i in contents){ if (contents[i]){ if (slots[i] && contents[i].count != slots[i]){ var rsp = { type: 'trade_change_item', tsid: this.tsid, itemstack_class: contents[i].class_id, amount: contents[i].count, slot: i, label: contents[i].label }; if (contents[i].is_tool) rsp.tool_state = contents[i].get_tool_state(); target.apiSendMsgAsIs(rsp); } } } if (item.apiIsDeleted()){ //log.info('Stack was merged'); return { ok: 1 }; } var rsp = { ok: 1, item_class: item_class, slot: intval(item.slot), count: item.count, label: item.label }; if (item.is_tool) rsp.tool_state = item.get_tool_state(); // Config? if (item.make_config){ rsp.config = item.make_config(); } return rsp; } // // Remove an item from the trade // function trading_remove_item(target_tsid, itemstack_tsid, amount){ //log.info(this.tsid+' removing item '+itemstack_tsid+' from trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } // // Get the item from escrow // delete this['!trade_accepted']; delete target['!trade_accepted']; var ret = this.trading_remove_item_do(itemstack_tsid, amount); if (!ret['ok']){ return ret; } // // Tell the other player // target.apiSendMsgAsIs({ type: 'trade_remove_item', tsid: this.tsid, itemstack_class: ret.item_class, amount: amount, slot: ret.slot, label: ret.label }); return { ok: 1 }; } function trading_remove_item_do(itemstack_tsid, amount){ var escrow = this.trading_get_escrow_bag(); if (escrow.items[itemstack_tsid]){ var slot = escrow.items[itemstack_tsid].slot; var item = escrow.removeItemStackTsid(itemstack_tsid, amount); //log.info('trading_remove_item_do slot is '+slot); } else{ return { ok: 0, error: "That item is not in your escrow storage." }; } if (item.count != amount){ this.items_put_back(item); return { ok: 0, error: "You don't have enough of that item in escrow." }; } var item_class = item.class_tsid; var item_label = item.label; var remaining = this.addItemStack(item); if (remaining){ var restore = this.removeItemStackClass(item.class_tsid, remaining); this.items_put_back(item); escrow.addItemStack(restore); return { ok: 0, error: "Oops! We couldn't place that item in your pack." }; } // // Do we need to move everything around? // this.trading_reorder_escrow(); return { ok: 1, item_class: item_class, slot: intval(slot), label: item_label }; } // // Move items around in the escrow bag in order to keep things in sequential slots // function trading_reorder_escrow(){ var escrow = this.trading_get_escrow_bag(); if (escrow.countContents()){ var escrow_contents = escrow.getContents(); for (var slot in escrow_contents){ if (!escrow_contents[slot]){ for (var i=intval(slot); i<escrow.capacity; i++){ if (escrow_contents[i+1]){ escrow.addItemStack(escrow.removeItemStackSlot(i+1), i); } } break; } } } } // // Change the amount of an item to trage // function trading_change_item(target_tsid, itemstack_tsid, amount){ //log.info(this.tsid+' changing item '+itemstack_tsid+' to trade with '+target_tsid+' ('+amount+')'); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } // // Adjust counts // delete this['!trade_accepted']; delete target['!trade_accepted']; var escrow = this.trading_get_escrow_bag(); var contents = escrow.getAllContents(); var item = contents[itemstack_tsid]; if (!item){ return { ok: 0, error: "That item is not in your escrow storage." }; } //log.info('trading_change_item '+item.count+' != '+amount); if (item.count != amount){ if (item.count < amount){ // We need an item from the pack to move var pack_item = this.findFirst(item.class_id); if (!pack_item){ return { ok: 0, error: "You don't have any more of that item." }; } //log.info('pack_item: '+pack_item.tsid); //log.info('Adding '+(amount-item.count)); var ret = this.trading_add_item_do(pack_item.tsid, amount-item.count, item.slot); amount = ret.count; } else{ //log.info('Removing '+(item.count-amount)); var ret = this.trading_remove_item_do(itemstack_tsid, item.count-amount); } if (!ret['ok']){ return ret; } // // Tell the other player // if (ret.item_class){ //log.info('trade_change_item ---------------------- slot '+ret.slot+' = '+amount); target.apiSendMsgAsIs({ type: 'trade_change_item', tsid: this.tsid, itemstack_class: ret.item_class, amount: amount, slot: ret.slot, label: ret.label, config: ret.config }); } } return { ok: 1 }; } // // Update the currants on the trade // function trading_update_currants(target_tsid, amount){ //log.info(this.tsid+' updating currants to '+amount+' on trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } // // Put the currants in escrow // delete this['!trade_accepted']; delete target['!trade_accepted']; var amount_diff = amount - this.trading.currants; //log.info('Currants diff of '+amount+' - '+this.trading.currants+' is '+amount_diff); //log.info('Player currently has: '+this.stats.currants.value); if (amount_diff != 0){ if (amount_diff < 0){ //log.info('Restoring '+Math.abs(amount_diff)); this.stats_add_currants(Math.abs(amount_diff)); } else{ if (!this.stats_try_remove_currants(amount_diff, {type: 'trading', target: target_tsid})){ return { ok: 0, error: "You don't have enough currants for that." }; } } this.trading.currants = amount; // // Tell the other player // target.apiSendMsgAsIs({ type: 'trade_currants', tsid: this.tsid, amount: this.trading.currants }); } return { ok: 1 }; } // // Accept the trade // function trading_accept(target_tsid){ //log.info(this.tsid+' accepting trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } this['!trade_accepted'] = true; // // Tell the other player // target.apiSendMsgAsIs({ type: 'trade_accept', tsid: this.tsid }); // // If both sides have accepted, then do it // if (target['!trade_accepted']){ var ret = this.trading_complete(target_tsid); if (!ret['ok']){ return ret; } } return { ok: 1 }; } // // Unlock the trade // function trading_unlock(target_tsid){ //log.info(this.tsid+' unlocking trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } delete this['!trade_accepted']; // // Tell the other player // target.apiSendMsgAsIs({ type: 'trade_unlock', tsid: this.tsid }); return { ok: 1 }; } // // Complete the trade // function trading_complete(target_tsid){ //log.info(this.tsid+' completing trade with '+target_tsid); // // Sanity check // if (!this['!is_trading'] || this['!is_trading'] != target_tsid){ return { ok: 0, error: 'You are not trading with that player.' }; } var target = getPlayer(target_tsid); if (!apiIsPlayerOnline(target_tsid)){ return { ok: 0, error: 'That player is not online.' }; } // // Have both sides accepted? // if (!this['!trade_accepted']){ return { ok: 0, error: 'You have not accepted this trade.' }; } if (!target['!trade_accepted']){ return { ok: 0, error: 'That player has not accepted this trade.' }; } // // Perform the transfer // this.trading_transfer(target_tsid); target.trading_transfer(this.tsid); // // Overlays // this.location.apiSendMsgAsIsX({ type: 'overlay_cancel', uid: this.tsid+'_trading' }, this); target.location.apiSendMsgAsIsX({ type: 'overlay_cancel', uid: target.tsid+'_trading' }, target); // // Tell both players that we are done // this.apiSendMsgAsIs({ type: 'trade_complete', tsid: target_tsid }); target.apiSendMsgAsIs({ type: 'trade_complete', tsid: this.tsid }); // // Cleanup and exit // delete this['!is_trading']; delete target['!is_trading']; delete this['!trade_accepted']; delete target['!trade_accepted']; return { ok: 1 }; } // // Transfer items/currants from escrow to target_tsid. // If something goes wrong, oh well! // function trading_transfer(target_tsid){ var target = getPlayer(target_tsid); // // Items! // var traded_something = false; var escrow = this.trading_get_escrow_bag(); if (escrow){ var contents = escrow.getContents(); var overflow = false; for (var i in contents){ if (contents[i]){ var item = escrow.removeItemStackSlot(i); // Item callback if (item.onTrade) item.onTrade(this, target); var remaining = target.addItemStack(item); if (remaining){ var target_escrow = target.trading_get_escrow_bag(); target_escrow.addItemStack(item); overflow = true; } traded_something = true; } } if (overflow){ target.prompts_add({ txt : "Some of the items you received in your trade with "+this.label+" did not fit in your pack. Your magic rock will hold them for you until you make room, and you cannot start another trade until you do so.", icon_buttons : false, timeout : 30, choices : [ { value : 'ok', label : 'Very well' } ] }); } } // // Currants! // if (this.trading.currants){ target.stats_add_currants(this.trading.currants, {'trade':this.tsid}); this.trading.currants = 0; traded_something = true; } if (traded_something){ // // Achievements // this.achievements_increment('players_traded', target_tsid); target.achievements_increment('players_traded', this.tsid); } }<|fim▁end|>
//
<|file_name|>server.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### import cherrypy import mako import mimetypes import os import six import girder.events from girder import constants, logprint, __version__ from girder.utility import plugin_utilities, model_importer from girder.utility import config from . import webroot with open(os.path.join(os.path.dirname(__file__), 'error.mako')) as f: _errorTemplate = f.read() def _errorDefault(status, message, *args, **kwargs): """ This is used to render error pages outside of the normal Girder app, such as 404's. This overrides the default cherrypy error pages. """ return mako.template.Template(_errorTemplate).render(status=status, message=message) def configureServer(test=False, plugins=None, curConfig=None): """ Function to setup the cherrypy server. It configures it, but does not actually start it. :param test: Set to True when running in the tests. :type test: bool :param plugins: If you wish to start the server with a custom set of plugins, pass this as a list of plugins to load. Otherwise, will use the PLUGINS_ENABLED setting value from the db. :param curConfig: The configuration dictionary to update. """ if curConfig is None: curConfig = config.getConfig() routeTable = loadRouteTable() appconf = { '/': { 'request.dispatch': cherrypy.dispatch.MethodDispatcher(), 'request.show_tracebacks': test, 'request.methods_with_bodies': ('POST', 'PUT', 'PATCH'), 'response.headers.server': 'Girder %s' % __version__, 'error_page.default': _errorDefault } } # Add MIME types for serving Fontello files from staticdir; # these may be missing or incorrect in the OS mimetypes.add_type('application/vnd.ms-fontobject', '.eot') mimetypes.add_type('application/x-font-ttf', '.ttf') mimetypes.add_type('application/font-woff', '.woff') if test: appconf['/src'] = { 'tools.staticdir.on': True, 'tools.staticdir.root': constants.STATIC_ROOT_DIR, 'tools.staticdir.dir': 'clients/web/src', } appconf['/test'] = { 'tools.staticdir.on': True, 'tools.staticdir.root': constants.STATIC_ROOT_DIR, 'tools.staticdir.dir': 'clients/web/test', } appconf['/clients'] = { 'tools.staticdir.on': True, 'tools.staticdir.root': constants.STATIC_ROOT_DIR, 'tools.staticdir.dir': 'clients' } appconf['/plugins'] = { 'tools.staticdir.on': True, 'tools.staticdir.root': constants.STATIC_ROOT_DIR, 'tools.staticdir.dir': 'plugins', } curConfig.update(appconf) if test: # Force some config params in testing mode curConfig.update({'server': { 'mode': 'testing', 'api_root': 'api/v1', 'static_root': 'static', 'api_static_root': '../static' }}) mode = curConfig['server']['mode'].lower() logprint.info('Running in mode: ' + mode) cherrypy.config['engine.autoreload.on'] = mode == 'development' # Don't import this until after the configs have been read; some module # initialization code requires the configuration to be set up. from girder.api import api_main root = webroot.Webroot() api_main.addApiToNode(root) cherrypy.engine.subscribe('start', girder.events.daemon.start) cherrypy.engine.subscribe('stop', girder.events.daemon.stop) if plugins is None: settings = model_importer.ModelImporter().model('setting') plugins = settings.get(constants.SettingKey.PLUGINS_ENABLED, default=()) plugins = list(plugin_utilities.getToposortedPlugins(plugins, ignoreMissing=True)) root.updateHtmlVars({ 'apiRoot': curConfig['server']['api_root'], 'staticRoot': os.path.relpath(routeTable[constants.GIRDER_STATIC_ROUTE_ID], routeTable[constants.GIRDER_ROUTE_ID]), 'plugins': plugins }) # Make the staticRoot relative to the api_root, if possible. The api_root # could be relative or absolute, but it needs to be in an absolute form for # relpath to behave as expected. We always expect the api_root to # contain at least two components, but the reference from static needs to # be from only the first component. apiRootBase = os.path.split(os.path.join('/', curConfig['server']['api_root']))[0] root.api.v1.updateHtmlVars({ 'apiRoot': curConfig['server']['api_root'], 'staticRoot': os.path.relpath(routeTable[constants.GIRDER_STATIC_ROUTE_ID], apiRootBase) }) root, appconf, _ = plugin_utilities.loadPlugins( plugins, root, appconf, root.api.v1, buildDag=False) return root, appconf def loadRouteTable(reconcileRoutes=False): """ Retrieves the route table from Girder and reconciles the state of it with the current application state. Reconciliation ensures that every enabled plugin has a route by assigning default routes for plugins that have none, such as newly-enabled plugins. :returns: The non empty routes (as a dict of name -> route) to be mounted by CherryPy during Girder's setup phase. """ pluginWebroots = plugin_utilities.getPluginWebroots() setting = model_importer.ModelImporter().model('setting') routeTable = setting.get(constants.SettingKey.ROUTE_TABLE) def reconcileRouteTable(routeTable): hasChanged = False for name in pluginWebroots.keys(): if name not in routeTable: routeTable[name] = os.path.join('/', name) hasChanged = True if hasChanged: setting.set(constants.SettingKey.ROUTE_TABLE, routeTable) return routeTable if reconcileRoutes: routeTable = reconcileRouteTable(routeTable) return {name: route for (name, route) in six.viewitems(routeTable) if route} def setup(test=False, plugins=None, curConfig=None): """ Configure and mount the Girder server and plugins under the appropriate routes. See ROUTE_TABLE setting. :param test: Whether to start in test mode. :param plugins: List of plugins to enable. :param curConfig: The config object to update. """ pluginWebroots = plugin_utilities.getPluginWebroots() girderWebroot, appconf = configureServer(test, plugins, curConfig) routeTable = loadRouteTable(reconcileRoutes=True) # Mount Girder application = cherrypy.tree.mount(girderWebroot, str(routeTable[constants.GIRDER_ROUTE_ID]), appconf) # Mount static files cherrypy.tree.mount(None, routeTable[constants.GIRDER_STATIC_ROUTE_ID], {'/': {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(constants.STATIC_ROOT_DIR, 'clients/web/static'), 'request.show_tracebacks': appconf['/']['request.show_tracebacks'], 'response.headers.server': 'Girder %s' % __version__, 'error_page.default': _errorDefault}}) # Mount API (special case)<|fim▁hole|> # The API is always mounted at /api AND at api relative to the Girder root cherrypy.tree.mount(girderWebroot.api, '/api', appconf) # Mount everything else in the routeTable for (name, route) in six.viewitems(routeTable): if name != constants.GIRDER_ROUTE_ID and name in pluginWebroots: cherrypy.tree.mount(pluginWebroots[name], route, appconf) if test: application.merge({'server': {'mode': 'testing'}}) return application class _StaticFileRoute(object): exposed = True def __init__(self, path, contentType=None): self.path = os.path.abspath(path) self.contentType = contentType def GET(self): return cherrypy.lib.static.serve_file(self.path, content_type=self.contentType) def staticFile(path, contentType=None): """ Helper function to serve a static file. This should be bound as the route object, i.e. info['serverRoot'].route_name = staticFile('...') :param path: The path of the static file to serve from this route. :type path: str :param contentType: The MIME type of the static file. If set to None, the content type wll be guessed by the file extension of the 'path' argument. """ return _StaticFileRoute(path, contentType)<|fim▁end|>
<|file_name|>fs_test.go<|end_file_name|><|fim▁begin|>// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package http_test import ( "bytes" "errors" "fmt" "io" "io/ioutil" "mime" "mime/multipart" "net" . "net/http" "net/http/httptest" "net/url" "os" "os/exec" "path" "path/filepath" "reflect" "regexp" "runtime" "strconv" "strings" "testing" "time" ) const ( testFile = "testdata/file" testFileLen = 11 ) type wantRange struct { start, end int64 // range [start,end) } var itoa = strconv.Itoa var ServeFileRangeTests = []struct { r string code int ranges []wantRange }{ {r: "", code: StatusOK}, {r: "bytes=0-4", code: StatusPartialContent, ranges: []wantRange{{0, 5}}}, {r: "bytes=2-", code: StatusPartialContent, ranges: []wantRange{{2, testFileLen}}}, {r: "bytes=-5", code: StatusPartialContent, ranges: []wantRange{{testFileLen - 5, testFileLen}}}, {r: "bytes=3-7", code: StatusPartialContent, ranges: []wantRange{{3, 8}}}, {r: "bytes=0-0,-2", code: StatusPartialContent, ranges: []wantRange{{0, 1}, {testFileLen - 2, testFileLen}}}, {r: "bytes=0-1,5-8", code: StatusPartialContent, ranges: []wantRange{{0, 2}, {5, 9}}}, {r: "bytes=0-1,5-", code: StatusPartialContent, ranges: []wantRange{{0, 2}, {5, testFileLen}}}, {r: "bytes=5-1000", code: StatusPartialContent, ranges: []wantRange{{5, testFileLen}}}, {r: "bytes=0-,1-,2-,3-,4-", code: StatusOK}, // ignore wasteful range request {r: "bytes=0-9", code: StatusPartialContent, ranges: []wantRange{{0, testFileLen - 1}}}, {r: "bytes=0-10", code: StatusPartialContent, ranges: []wantRange{{0, testFileLen}}}, {r: "bytes=0-11", code: StatusPartialContent, ranges: []wantRange{{0, testFileLen}}}, {r: "bytes=10-11", code: StatusPartialContent, ranges: []wantRange{{testFileLen - 1, testFileLen}}}, {r: "bytes=10-", code: StatusPartialContent, ranges: []wantRange{{testFileLen - 1, testFileLen}}}, {r: "bytes=11-", code: StatusRequestedRangeNotSatisfiable}, {r: "bytes=11-12", code: StatusRequestedRangeNotSatisfiable}, {r: "bytes=12-12", code: StatusRequestedRangeNotSatisfiable}, {r: "bytes=11-100", code: StatusRequestedRangeNotSatisfiable}, {r: "bytes=12-100", code: StatusRequestedRangeNotSatisfiable}, {r: "bytes=100-", code: StatusRequestedRangeNotSatisfiable}, {r: "bytes=100-1000", code: StatusRequestedRangeNotSatisfiable}, } func TestServeFile(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { ServeFile(w, r, "testdata/file") })) defer ts.Close() var err error file, err := ioutil.ReadFile(testFile) if err != nil { t.Fatal("reading file:", err) } // set up the Request (re-used for all tests) var req Request req.Header = make(Header) if req.URL, err = url.Parse(ts.URL); err != nil { t.Fatal("ParseURL:", err) } req.Method = "GET" // straight GET _, body := getBody(t, "straight get", req) if !bytes.Equal(body, file) { t.Fatalf("body mismatch: got %q, want %q", body, file) } // Range tests Cases: for _, rt := range ServeFileRangeTests { if rt.r != "" { req.Header.Set("Range", rt.r) } resp, body := getBody(t, fmt.Sprintf("range test %q", rt.r), req) if resp.StatusCode != rt.code { t.Errorf("range=%q: StatusCode=%d, want %d", rt.r, resp.StatusCode, rt.code) } if rt.code == StatusRequestedRangeNotSatisfiable { continue } wantContentRange := "" if len(rt.ranges) == 1 { rng := rt.ranges[0] wantContentRange = fmt.Sprintf("bytes %d-%d/%d", rng.start, rng.end-1, testFileLen) } cr := resp.Header.Get("Content-Range") if cr != wantContentRange { t.Errorf("range=%q: Content-Range = %q, want %q", rt.r, cr, wantContentRange) } ct := resp.Header.Get("Content-Type") if len(rt.ranges) == 1 { rng := rt.ranges[0] wantBody := file[rng.start:rng.end] if !bytes.Equal(body, wantBody) { t.Errorf("range=%q: body = %q, want %q", rt.r, body, wantBody) } if strings.HasPrefix(ct, "multipart/byteranges") { t.Errorf("range=%q content-type = %q; unexpected multipart/byteranges", rt.r, ct) } } if len(rt.ranges) > 1 { typ, params, err := mime.ParseMediaType(ct) if err != nil { t.Errorf("range=%q content-type = %q; %v", rt.r, ct, err) continue } if typ != "multipart/byteranges" { t.Errorf("range=%q content-type = %q; want multipart/byteranges", rt.r, typ) continue } if params["boundary"] == "" { t.Errorf("range=%q content-type = %q; lacks boundary", rt.r, ct) continue } if g, w := resp.ContentLength, int64(len(body)); g != w { t.Errorf("range=%q Content-Length = %d; want %d", rt.r, g, w) continue } mr := multipart.NewReader(bytes.NewReader(body), params["boundary"]) for ri, rng := range rt.ranges { part, err := mr.NextPart() if err != nil { t.Errorf("range=%q, reading part index %d: %v", rt.r, ri, err) continue Cases } wantContentRange = fmt.Sprintf("bytes %d-%d/%d", rng.start, rng.end-1, testFileLen) if g, w := part.Header.Get("Content-Range"), wantContentRange; g != w { t.Errorf("range=%q: part Content-Range = %q; want %q", rt.r, g, w) } body, err := ioutil.ReadAll(part) if err != nil { t.Errorf("range=%q, reading part index %d body: %v", rt.r, ri, err) continue Cases } wantBody := file[rng.start:rng.end] if !bytes.Equal(body, wantBody) { t.Errorf("range=%q: body = %q, want %q", rt.r, body, wantBody) } } _, err = mr.NextPart() if err != io.EOF { t.Errorf("range=%q; expected final error io.EOF; got %v", rt.r, err) } } } } var fsRedirectTestData = []struct { original, redirect string }{ {"/test/index.html", "/test/"}, {"/test/testdata", "/test/testdata/"}, {"/test/testdata/file/", "/test/testdata/file"}, } func TestFSRedirect(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(StripPrefix("/test", FileServer(Dir(".")))) defer ts.Close() for _, data := range fsRedirectTestData { res, err := Get(ts.URL + data.original) if err != nil { t.Fatal(err) } res.Body.Close() if g, e := res.Request.URL.Path, data.redirect; g != e { t.Errorf("redirect from %s: got %s, want %s", data.original, g, e) } } } type testFileSystem struct { open func(name string) (File, error) } func (fs *testFileSystem) Open(name string) (File, error) { return fs.open(name) } func TestFileServerCleans(t *testing.T) { defer afterTest(t) ch := make(chan string, 1) fs := FileServer(&testFileSystem{func(name string) (File, error) { ch <- name return nil, errors.New("file does not exist") }}) tests := []struct { reqPath, openArg string }{ {"/foo.txt", "/foo.txt"}, {"//foo.txt", "/foo.txt"}, {"/../foo.txt", "/foo.txt"}, } req, _ := NewRequest("GET", "http://example.com", nil) for n, test := range tests { rec := httptest.NewRecorder() req.URL.Path = test.reqPath fs.ServeHTTP(rec, req) if got := <-ch; got != test.openArg { t.Errorf("test %d: got %q, want %q", n, got, test.openArg) } } } func TestFileServerEscapesNames(t *testing.T) { defer afterTest(t) const dirListPrefix = "<pre>\n" const dirListSuffix = "\n</pre>\n" tests := []struct { name, escaped string }{ {`simple_name`, `<a href="simple_name">simple_name</a>`}, {`"'<>&`, `<a href="%22%27%3C%3E&">&#34;&#39;&lt;&gt;&amp;</a>`}, {`?foo=bar#baz`, `<a href="%3Ffoo=bar%23baz">?foo=bar#baz</a>`}, {`<combo>?foo`, `<a href="%3Ccombo%3E%3Ffoo">&lt;combo&gt;?foo</a>`}, } // We put each test file in its own directory in the fakeFS so we can look at it in isolation. fs := make(fakeFS) for i, test := range tests { testFile := &fakeFileInfo{basename: test.name} fs[fmt.Sprintf("/%d", i)] = &fakeFileInfo{ dir: true, modtime: time.Unix(1000000000, 0).UTC(), ents: []*fakeFileInfo{testFile}, } fs[fmt.Sprintf("/%d/%s", i, test.name)] = testFile } ts := httptest.NewServer(FileServer(&fs)) defer ts.Close() for i, test := range tests { url := fmt.Sprintf("%s/%d", ts.URL, i) res, err := Get(url) if err != nil { t.Fatalf("test %q: Get: %v", test.name, err) } b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatalf("test %q: read Body: %v", test.name, err) } s := string(b) if !strings.HasPrefix(s, dirListPrefix) || !strings.HasSuffix(s, dirListSuffix) { t.Errorf("test %q: listing dir, full output is %q, want prefix %q and suffix %q", test.name, s, dirListPrefix, dirListSuffix) } if trimmed := strings.TrimSuffix(strings.TrimPrefix(s, dirListPrefix), dirListSuffix); trimmed != test.escaped { t.Errorf("test %q: listing dir, filename escaped to %q, want %q", test.name, trimmed, test.escaped) } res.Body.Close() } } func TestFileServerSortsNames(t *testing.T) { defer afterTest(t) const contents = "I am a fake file" dirMod := time.Unix(123, 0).UTC() fileMod := time.Unix(1000000000, 0).UTC() fs := fakeFS{ "/": &fakeFileInfo{ dir: true, modtime: dirMod, ents: []*fakeFileInfo{ { basename: "b", modtime: fileMod, contents: contents, }, { basename: "a", modtime: fileMod, contents: contents, }, }, }, } ts := httptest.NewServer(FileServer(&fs)) defer ts.Close() res, err := Get(ts.URL) if err != nil { t.Fatalf("Get: %v", err) } defer res.Body.Close() b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatalf("read Body: %v", err) } s := string(b) if !strings.Contains(s, "<a href=\"a\">a</a>\n<a href=\"b\">b</a>") { t.Errorf("output appears to be unsorted:\n%s", s) } } func mustRemoveAll(dir string) { err := os.RemoveAll(dir) if err != nil { panic(err) } } func TestFileServerImplicitLeadingSlash(t *testing.T) { defer afterTest(t) tempDir, err := ioutil.TempDir("", "") if err != nil { t.Fatalf("TempDir: %v", err) } defer mustRemoveAll(tempDir) if err := ioutil.WriteFile(filepath.Join(tempDir, "foo.txt"), []byte("Hello world"), 0644); err != nil { t.Fatalf("WriteFile: %v", err) } ts := httptest.NewServer(StripPrefix("/bar/", FileServer(Dir(tempDir)))) defer ts.Close() get := func(suffix string) string { res, err := Get(ts.URL + suffix) if err != nil { t.Fatalf("Get %s: %v", suffix, err) } b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatalf("ReadAll %s: %v", suffix, err) } res.Body.Close() return string(b) } if s := get("/bar/"); !strings.Contains(s, ">foo.txt<") { t.Logf("expected a directory listing with foo.txt, got %q", s) } if s := get("/bar/foo.txt"); s != "Hello world" { t.Logf("expected %q, got %q", "Hello world", s) } } func TestDirJoin(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("skipping test on windows") } wfi, err := os.Stat("/etc/hosts") if err != nil { t.Skip("skipping test; no /etc/hosts file") } test := func(d Dir, name string) { f, err := d.Open(name) if err != nil { t.Fatalf("open of %s: %v", name, err) } defer f.Close() gfi, err := f.Stat() if err != nil { t.Fatalf("stat of %s: %v", name, err) } if !os.SameFile(gfi, wfi) { t.Errorf("%s got different file", name) } } test(Dir("/etc/"), "/hosts") test(Dir("/etc/"), "hosts") test(Dir("/etc/"), "../../../../hosts") test(Dir("/etc"), "/hosts") test(Dir("/etc"), "hosts") test(Dir("/etc"), "../../../../hosts") // Not really directories, but since we use this trick in // ServeFile, test it: test(Dir("/etc/hosts"), "") test(Dir("/etc/hosts"), "/") test(Dir("/etc/hosts"), "../") } func TestEmptyDirOpenCWD(t *testing.T) { test := func(d Dir) { name := "fs_test.go" f, err := d.Open(name) if err != nil { t.Fatalf("open of %s: %v", name, err) } defer f.Close() } test(Dir("")) test(Dir(".")) test(Dir("./")) } func TestServeFileContentType(t *testing.T) { defer afterTest(t) const ctype = "icecream/chocolate" ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { switch r.FormValue("override") { case "1": w.Header().Set("Content-Type", ctype) case "2": // Explicitly inhibit sniffing. w.Header()["Content-Type"] = []string{} } ServeFile(w, r, "testdata/file") })) defer ts.Close() get := func(override string, want []string) { resp, err := Get(ts.URL + "?override=" + override) if err != nil { t.Fatal(err) } if h := resp.Header["Content-Type"]; !reflect.DeepEqual(h, want) { t.Errorf("Content-Type mismatch: got %v, want %v", h, want) } resp.Body.Close() } get("0", []string{"text/plain; charset=utf-8"}) get("1", []string{ctype}) get("2", nil) } func TestServeFileMimeType(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { ServeFile(w, r, "testdata/style.css") })) defer ts.Close() resp, err := Get(ts.URL) if err != nil { t.Fatal(err) } resp.Body.Close() want := "text/css; charset=utf-8" if h := resp.Header.Get("Content-Type"); h != want { t.Errorf("Content-Type mismatch: got %q, want %q", h, want) } } func TestServeFileFromCWD(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { ServeFile(w, r, "fs_test.go") })) defer ts.Close() r, err := Get(ts.URL) if err != nil { t.Fatal(err) } r.Body.Close() if r.StatusCode != 200 { t.Fatalf("expected 200 OK, got %s", r.Status) } } func TestServeFileWithContentEncoding(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { w.Header().Set("Content-Encoding", "foo") ServeFile(w, r, "testdata/file") })) defer ts.Close() resp, err := Get(ts.URL) if err != nil { t.Fatal(err) } resp.Body.Close() if g, e := resp.ContentLength, int64(-1); g != e { t.Errorf("Content-Length mismatch: got %d, want %d", g, e) } } func TestServeIndexHtml(t *testing.T) { defer afterTest(t) const want = "index.html says hello\n" ts := httptest.NewServer(FileServer(Dir("."))) defer ts.Close() for _, path := range []string{"/testdata/", "/testdata/index.html"} { res, err := Get(ts.URL + path) if err != nil { t.Fatal(err) } b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatal("reading Body:", err) } if s := string(b); s != want { t.Errorf("for path %q got %q, want %q", path, s, want) } res.Body.Close() } } func TestFileServerZeroByte(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(FileServer(Dir("."))) defer ts.Close() res, err := Get(ts.URL + "/..\x00") if err != nil { t.Fatal(err) } b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatal("reading Body:", err) } if res.StatusCode == 200 { t.Errorf("got status 200; want an error. Body is:\n%s", string(b)) } } type fakeFileInfo struct { dir bool basename string modtime time.Time ents []*fakeFileInfo contents string err error } func (f *fakeFileInfo) Name() string { return f.basename } func (f *fakeFileInfo) Sys() interface{} { return nil } func (f *fakeFileInfo) ModTime() time.Time { return f.modtime } func (f *fakeFileInfo) IsDir() bool { return f.dir } func (f *fakeFileInfo) Size() int64 { return int64(len(f.contents)) } func (f *fakeFileInfo) Mode() os.FileMode { if f.dir { return 0755 | os.ModeDir } return 0644 } type fakeFile struct { io.ReadSeeker fi *fakeFileInfo path string // as opened entpos int } func (f *fakeFile) Close() error { return nil } func (f *fakeFile) Stat() (os.FileInfo, error) { return f.fi, nil } func (f *fakeFile) Readdir(count int) ([]os.FileInfo, error) { if !f.fi.dir { return nil, os.ErrInvalid } var fis []os.FileInfo limit := f.entpos + count if count <= 0 || limit > len(f.fi.ents) { limit = len(f.fi.ents) } for ; f.entpos < limit; f.entpos++ { fis = append(fis, f.fi.ents[f.entpos]) } if len(fis) == 0 && count > 0 { return fis, io.EOF } else { return fis, nil } } type fakeFS map[string]*fakeFileInfo func (fs fakeFS) Open(name string) (File, error) { name = path.Clean(name) f, ok := fs[name] if !ok { return nil, os.ErrNotExist } if f.err != nil { return nil, f.err } return &fakeFile{ReadSeeker: strings.NewReader(f.contents), fi: f, path: name}, nil } func TestDirectoryIfNotModified(t *testing.T) { defer afterTest(t) const indexContents = "I am a fake index.html file" fileMod := time.Unix(1000000000, 0).UTC() fileModStr := fileMod.Format(TimeFormat) dirMod := time.Unix(123, 0).UTC() indexFile := &fakeFileInfo{ basename: "index.html", modtime: fileMod, contents: indexContents, } fs := fakeFS{ "/": &fakeFileInfo{ dir: true, modtime: dirMod, ents: []*fakeFileInfo{indexFile}, },<|fim▁hole|> defer ts.Close() res, err := Get(ts.URL) if err != nil { t.Fatal(err) } b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatal(err) } if string(b) != indexContents { t.Fatalf("Got body %q; want %q", b, indexContents) } res.Body.Close() lastMod := res.Header.Get("Last-Modified") if lastMod != fileModStr { t.Fatalf("initial Last-Modified = %q; want %q", lastMod, fileModStr) } req, _ := NewRequest("GET", ts.URL, nil) req.Header.Set("If-Modified-Since", lastMod) res, err = DefaultClient.Do(req) if err != nil { t.Fatal(err) } if res.StatusCode != 304 { t.Fatalf("Code after If-Modified-Since request = %v; want 304", res.StatusCode) } res.Body.Close() // Advance the index.html file's modtime, but not the directory's. indexFile.modtime = indexFile.modtime.Add(1 * time.Hour) res, err = DefaultClient.Do(req) if err != nil { t.Fatal(err) } if res.StatusCode != 200 { t.Fatalf("Code after second If-Modified-Since request = %v; want 200; res is %#v", res.StatusCode, res) } res.Body.Close() } func mustStat(t *testing.T, fileName string) os.FileInfo { fi, err := os.Stat(fileName) if err != nil { t.Fatal(err) } return fi } func TestServeContent(t *testing.T) { defer afterTest(t) type serveParam struct { name string modtime time.Time content io.ReadSeeker contentType string etag string } servec := make(chan serveParam, 1) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { p := <-servec if p.etag != "" { w.Header().Set("ETag", p.etag) } if p.contentType != "" { w.Header().Set("Content-Type", p.contentType) } ServeContent(w, r, p.name, p.modtime, p.content) })) defer ts.Close() type testCase struct { // One of file or content must be set: file string content io.ReadSeeker modtime time.Time serveETag string // optional serveContentType string // optional reqHeader map[string]string wantLastMod string wantContentType string wantStatus int } htmlModTime := mustStat(t, "testdata/index.html").ModTime() tests := map[string]testCase{ "no_last_modified": { file: "testdata/style.css", wantContentType: "text/css; charset=utf-8", wantStatus: 200, }, "with_last_modified": { file: "testdata/index.html", wantContentType: "text/html; charset=utf-8", modtime: htmlModTime, wantLastMod: htmlModTime.UTC().Format(TimeFormat), wantStatus: 200, }, "not_modified_modtime": { file: "testdata/style.css", modtime: htmlModTime, reqHeader: map[string]string{ "If-Modified-Since": htmlModTime.UTC().Format(TimeFormat), }, wantStatus: 304, }, "not_modified_modtime_with_contenttype": { file: "testdata/style.css", serveContentType: "text/css", // explicit content type modtime: htmlModTime, reqHeader: map[string]string{ "If-Modified-Since": htmlModTime.UTC().Format(TimeFormat), }, wantStatus: 304, }, "not_modified_etag": { file: "testdata/style.css", serveETag: `"foo"`, reqHeader: map[string]string{ "If-None-Match": `"foo"`, }, wantStatus: 304, }, "not_modified_etag_no_seek": { content: panicOnSeek{nil}, // should never be called serveETag: `"foo"`, reqHeader: map[string]string{ "If-None-Match": `"foo"`, }, wantStatus: 304, }, "range_good": { file: "testdata/style.css", serveETag: `"A"`, reqHeader: map[string]string{ "Range": "bytes=0-4", }, wantStatus: StatusPartialContent, wantContentType: "text/css; charset=utf-8", }, // An If-Range resource for entity "A", but entity "B" is now current. // The Range request should be ignored. "range_no_match": { file: "testdata/style.css", serveETag: `"A"`, reqHeader: map[string]string{ "Range": "bytes=0-4", "If-Range": `"B"`, }, wantStatus: 200, wantContentType: "text/css; charset=utf-8", }, "range_with_modtime": { file: "testdata/style.css", modtime: time.Date(2014, 6, 25, 17, 12, 18, 0 /* nanos */, time.UTC), reqHeader: map[string]string{ "Range": "bytes=0-4", "If-Range": "Wed, 25 Jun 2014 17:12:18 GMT", }, wantStatus: StatusPartialContent, wantContentType: "text/css; charset=utf-8", wantLastMod: "Wed, 25 Jun 2014 17:12:18 GMT", }, "range_with_modtime_nanos": { file: "testdata/style.css", modtime: time.Date(2014, 6, 25, 17, 12, 18, 123 /* nanos */, time.UTC), reqHeader: map[string]string{ "Range": "bytes=0-4", "If-Range": "Wed, 25 Jun 2014 17:12:18 GMT", }, wantStatus: StatusPartialContent, wantContentType: "text/css; charset=utf-8", wantLastMod: "Wed, 25 Jun 2014 17:12:18 GMT", }, "unix_zero_modtime": { content: strings.NewReader("<html>foo"), modtime: time.Unix(0, 0), wantStatus: StatusOK, wantContentType: "text/html; charset=utf-8", }, } for testName, tt := range tests { var content io.ReadSeeker if tt.file != "" { f, err := os.Open(tt.file) if err != nil { t.Fatalf("test %q: %v", testName, err) } defer f.Close() content = f } else { content = tt.content } servec <- serveParam{ name: filepath.Base(tt.file), content: content, modtime: tt.modtime, etag: tt.serveETag, contentType: tt.serveContentType, } req, err := NewRequest("GET", ts.URL, nil) if err != nil { t.Fatal(err) } for k, v := range tt.reqHeader { req.Header.Set(k, v) } res, err := DefaultClient.Do(req) if err != nil { t.Fatal(err) } io.Copy(ioutil.Discard, res.Body) res.Body.Close() if res.StatusCode != tt.wantStatus { t.Errorf("test %q: status = %d; want %d", testName, res.StatusCode, tt.wantStatus) } if g, e := res.Header.Get("Content-Type"), tt.wantContentType; g != e { t.Errorf("test %q: content-type = %q, want %q", testName, g, e) } if g, e := res.Header.Get("Last-Modified"), tt.wantLastMod; g != e { t.Errorf("test %q: last-modified = %q, want %q", testName, g, e) } } } // Issue 12991 func TestServerFileStatError(t *testing.T) { rec := httptest.NewRecorder() r, _ := NewRequest("GET", "http://foo/", nil) redirect := false name := "file.txt" fs := issue12991FS{} ExportServeFile(rec, r, fs, name, redirect) if body := rec.Body.String(); !strings.Contains(body, "403") || !strings.Contains(body, "Forbidden") { t.Errorf("wanted 403 forbidden message; got: %s", body) } } type issue12991FS struct{} func (issue12991FS) Open(string) (File, error) { return issue12991File{}, nil } type issue12991File struct{ File } func (issue12991File) Stat() (os.FileInfo, error) { return nil, os.ErrPermission } func (issue12991File) Close() error { return nil } func TestServeContentErrorMessages(t *testing.T) { defer afterTest(t) fs := fakeFS{ "/500": &fakeFileInfo{ err: errors.New("random error"), }, "/403": &fakeFileInfo{ err: &os.PathError{Err: os.ErrPermission}, }, } ts := httptest.NewServer(FileServer(fs)) defer ts.Close() for _, code := range []int{403, 404, 500} { res, err := DefaultClient.Get(fmt.Sprintf("%s/%d", ts.URL, code)) if err != nil { t.Errorf("Error fetching /%d: %v", code, err) continue } if res.StatusCode != code { t.Errorf("For /%d, status code = %d; want %d", code, res.StatusCode, code) } res.Body.Close() } } // verifies that sendfile is being used on Linux func TestLinuxSendfile(t *testing.T) { defer afterTest(t) if runtime.GOOS != "linux" { t.Skip("skipping; linux-only test") } if _, err := exec.LookPath("strace"); err != nil { t.Skip("skipping; strace not found in path") } ln, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatal(err) } lnf, err := ln.(*net.TCPListener).File() if err != nil { t.Fatal(err) } defer ln.Close() syscalls := "sendfile,sendfile64" switch runtime.GOARCH { case "mips64", "mips64le": // mips64 strace doesn't support sendfile64 and will error out // if we specify that with `-e trace='. syscalls = "sendfile" } var buf bytes.Buffer child := exec.Command("strace", "-f", "-q", "-e", "trace="+syscalls, os.Args[0], "-test.run=TestLinuxSendfileChild") child.ExtraFiles = append(child.ExtraFiles, lnf) child.Env = append([]string{"GO_WANT_HELPER_PROCESS=1"}, os.Environ()...) child.Stdout = &buf child.Stderr = &buf if err := child.Start(); err != nil { t.Skipf("skipping; failed to start straced child: %v", err) } res, err := Get(fmt.Sprintf("http://%s/", ln.Addr())) if err != nil { t.Fatalf("http client error: %v", err) } _, err = io.Copy(ioutil.Discard, res.Body) if err != nil { t.Fatalf("client body read error: %v", err) } res.Body.Close() // Force child to exit cleanly. Get(fmt.Sprintf("http://%s/quit", ln.Addr())) child.Wait() rx := regexp.MustCompile(`sendfile(64)?\(\d+,\s*\d+,\s*NULL,\s*\d+\)\s*=\s*\d+\s*\n`) rxResume := regexp.MustCompile(`<\.\.\. sendfile(64)? resumed> \)\s*=\s*\d+\s*\n`) out := buf.String() if !rx.MatchString(out) && !rxResume.MatchString(out) { t.Errorf("no sendfile system call found in:\n%s", out) } } func getBody(t *testing.T, testName string, req Request) (*Response, []byte) { r, err := DefaultClient.Do(&req) if err != nil { t.Fatalf("%s: for URL %q, send error: %v", testName, req.URL.String(), err) } b, err := ioutil.ReadAll(r.Body) if err != nil { t.Fatalf("%s: for URL %q, reading body: %v", testName, req.URL.String(), err) } return r, b } // TestLinuxSendfileChild isn't a real test. It's used as a helper process // for TestLinuxSendfile. func TestLinuxSendfileChild(*testing.T) { if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { return } defer os.Exit(0) fd3 := os.NewFile(3, "ephemeral-port-listener") ln, err := net.FileListener(fd3) if err != nil { panic(err) } mux := NewServeMux() mux.Handle("/", FileServer(Dir("testdata"))) mux.HandleFunc("/quit", func(ResponseWriter, *Request) { os.Exit(0) }) s := &Server{Handler: mux} err = s.Serve(ln) if err != nil { panic(err) } } func TestFileServerCleanPath(t *testing.T) { tests := []struct { path string wantCode int wantOpen []string }{ {"/", 200, []string{"/", "/index.html"}}, {"/dir", 301, []string{"/dir"}}, {"/dir/", 200, []string{"/dir", "/dir/index.html"}}, } for _, tt := range tests { var log []string rr := httptest.NewRecorder() req, _ := NewRequest("GET", "http://foo.localhost"+tt.path, nil) FileServer(fileServerCleanPathDir{&log}).ServeHTTP(rr, req) if !reflect.DeepEqual(log, tt.wantOpen) { t.Logf("For %s: Opens = %q; want %q", tt.path, log, tt.wantOpen) } if rr.Code != tt.wantCode { t.Logf("For %s: Response code = %d; want %d", tt.path, rr.Code, tt.wantCode) } } } type fileServerCleanPathDir struct { log *[]string } func (d fileServerCleanPathDir) Open(path string) (File, error) { *(d.log) = append(*(d.log), path) if path == "/" || path == "/dir" || path == "/dir/" { // Just return back something that's a directory. return Dir(".").Open(".") } return nil, os.ErrNotExist } type panicOnSeek struct{ io.ReadSeeker }<|fim▁end|>
"/index.html": indexFile, } ts := httptest.NewServer(FileServer(fs))
<|file_name|>cstyle.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python -tt # # Copyright (C) 2005-2017 Erik de Castro Lopo <[email protected]> # # Released under the 2 clause BSD license. """ This program checks C code for compliance to coding standards used in libsndfile and other projects I run. """ import re import sys class Preprocessor: """ Preprocess lines of C code to make it easier for the CStyleChecker class to test for correctness. Preprocessing works on a single line at a time but maintains state between consecutive lines so it can preprocessess multi-line comments. Preprocessing involves: - Strip C++ style comments from a line. - Strip C comments from a series of lines. When a C comment starts and ends on the same line it will be replaced with 'comment'. - Replace arbitrary C strings with the zero length string. - Replace '#define f(x)' with '#define f (c)' (The C #define requires that there be no space between defined macro name and the open paren of the argument list). Used by the CStyleChecker class. """ def __init__ (self): self.comment_nest = 0 self.leading_space_re = re.compile ('^(\t+| )') self.trailing_space_re = re.compile ('(\t+| )$') self.define_hack_re = re.compile ("(#\s*define\s+[a-zA-Z0-9_]+)\(") def comment_nesting (self): """ Return the currect comment nesting. At the start and end of the file, this value should be zero. Inside C comments it should be 1 or (possibly) more. """ return self.comment_nest def __call__ (self, line): """ Strip the provided line of C and C++ comments. Stripping of multi-line C comments works as expected. """ line = self.define_hack_re.sub (r'\1 (', line) line = self.process_strings (line) # Strip C++ style comments. if self.comment_nest == 0: line = re.sub ("( |\t*)//.*", '', line) # Strip C style comments. open_comment = line.find ('/*') close_comment = line.find ('*/') if self.comment_nest > 0 and close_comment < 0: # Inside a comment block that does not close on this line. return "" if open_comment >= 0 and close_comment < 0: # A comment begins on this line but doesn't close on this line. self.comment_nest += 1 return self.trailing_space_re.sub ('', line [:open_comment]) if open_comment < 0 and close_comment >= 0: # Currently open comment ends on this line. self.comment_nest -= 1 return self.trailing_space_re.sub ('', line [close_comment + 2:]) if open_comment >= 0 and close_comment > 0 and self.comment_nest == 0: # Comment begins and ends on this line. Replace it with 'comment' # so we don't need to check whitespace before and after the comment # we're removing. newline = line [:open_comment] + "comment" + line [close_comment + 2:] return self.__call__ (newline) return line def process_strings (self, line): """ Given a line of C code, return a string where all literal C strings have been replaced with the empty string literal "". """ for k in range (0, len (line)): if line [k] == '"': start = k for k in range (start + 1, len (line)): if line [k] == '"' and line [k - 1] != '\\': return line [:start + 1] + '"' + self.process_strings (line [k + 1:]) return line class CStyleChecker: """ A class for checking the whitespace and layout of a C code. """ def __init__ (self, debug): self.debug = debug self.filename = None self.error_count = 0 self.line_num = 1 self.orig_line = '' self.trailing_newline_re = re.compile ('[\r\n]+$') self.indent_re = re.compile ("^\s*") self.last_line_indent = "" self.last_line_indent_curly = False self.re_checks = \ [ ( re.compile (" "), "multiple space instead of tab" ) , ( re.compile ("\t "), "space after tab" ) , ( re.compile ("[^ ];"), "missing space before semi-colon" ) , ( re.compile ("{[^\s}]"), "missing space after open brace" ) , ( re.compile ("[^{\s]}"), "missing space before close brace" ) , ( re.compile ("[ \t]+$"), "contains trailing whitespace" ) , ( re.compile (",[^\s\n]"), "missing space after comma" ) , ( re.compile (";[^\s]"), "missing space after semi-colon" ) , ( re.compile ("=[^\s\"'=]"), "missing space after assignment" ) # Open and close parenthesis. , ( re.compile ("[^\s\(\[\*&']\("), "missing space before open parenthesis" ) , ( re.compile ("\)(-[^>]|[^,'\s\n\)\]-])"), "missing space after close parenthesis" ) , ( re.compile ("\s(do|for|if|when)\s.*{$"), "trailing open parenthesis at end of line" ) , ( re.compile ("\( [^;]"), "space after open parenthesis" ) , ( re.compile ("[^;] \)"), "space before close parenthesis" ) # Open and close square brace. , ( re.compile ("[^\s\(\]]\["), "missing space before open square brace" ) , ( re.compile ("\][^,\)\]\[\s\.-]"), "missing space after close square brace" ) , ( re.compile ("\[ "), "space after open square brace" ) , ( re.compile (" \]"), "space before close square brace" ) # Space around operators. , ( re.compile ("[^\s][\*/%+-][=][^\s]"), "missing space around opassign" ) , ( re.compile ("[^\s][<>!=^/][=]{1,2}[^\s]"), "missing space around comparison" ) # Parens around single argument to return. , ( re.compile ("\s+return\s+\([a-zA-Z0-9_]+\)\s+;"), "parens around return value" ) # Parens around single case argument. , ( re.compile ("\s+case\s+\([a-zA-Z0-9_]+\)\s+:"), "parens around single case argument" ) # Open curly at end of line. , ( re.compile ("\)\s*{\s*$"), "open curly brace at end of line" ) # Pre and post increment/decrment. , ( re.compile ("[^\(\[][+-]{2}[a-zA-Z0-9_]"), "space after pre increment/decrement" ) , ( re.compile ("[a-zA-Z0-9_][+-]{2}[^\)\,]]"), "space before post increment/decrement" ) ] def get_error_count (self): """ Return the current error count for this CStyleChecker object. """ return self.error_count def check_files (self, files): """ Run the style checker on all the specified files. """ for filename in files: self.check_file (filename) def check_file (self, filename): """ Run the style checker on the specified file. """ self.filename = filename cfile = open (filename, "r") self.line_num = 1 preprocess = Preprocessor () while 1: line = cfile.readline () if not line: break line = self.trailing_newline_re.sub ('', line) self.orig_line = line self.line_checks (preprocess (line)) self.line_num += 1<|fim▁hole|> self.filename = None # Check for errors finding comments. if preprocess.comment_nesting () != 0: print ("Weird, comments nested incorrectly.") sys.exit (1) return def line_checks (self, line): """ Run the style checker on provided line of text, but within the context of how the line fits within the file. """ indent = len (self.indent_re.search (line).group ()) if re.search ("^\s+}", line): if not self.last_line_indent_curly and indent != self.last_line_indent: None # self.error ("bad indent on close curly brace") self.last_line_indent_curly = True else: self.last_line_indent_curly = False # Now all the regex checks. for (check_re, msg) in self.re_checks: if check_re.search (line): self.error (msg) if re.search ("[a-zA-Z0-9][<>!=^/&\|]{1,2}[a-zA-Z0-9]", line): if not re.search (".*#include.*[a-zA-Z0-9]/[a-zA-Z]", line): self.error ("missing space around operator") self.last_line_indent = indent return def error (self, msg): """ Print an error message and increment the error count. """ print ("%s (%d) : %s" % (self.filename, self.line_num, msg)) if self.debug: print ("'" + self.orig_line + "'") self.error_count += 1 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- if len (sys.argv) < 1: print ("Usage : yada yada") sys.exit (1) # Create a new CStyleChecker object if sys.argv [1] == '-d' or sys.argv [1] == '--debug': cstyle = CStyleChecker (True) cstyle.check_files (sys.argv [2:]) else: cstyle = CStyleChecker (False) cstyle.check_files (sys.argv [1:]) if cstyle.get_error_count (): sys.exit (1) sys.exit (0)<|fim▁end|>
cfile.close ()
<|file_name|>plot_conv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import matplotlib.pyplot as plt from math import sqrt from math import log<|fim▁hole|>dx = [1/sqrt(16), 1/sqrt(64), 1/sqrt(256), 1/sqrt(1024)] dx_tri = [1/sqrt(32), 1/sqrt(128), 1/sqrt(512), 1/sqrt(2048)] dx_pert = [0.0270466, 0.0134827, 0.00680914, 0.00367054] dx_fp = [0.122799, 0.081584, 0.0445639, 0.0225922, 0.0113763] fp_actual = 0.0441995 rl2_euler = [0.00059068, 0.000113051, 2.26156e-05, 5.11884e-06] rl2_euler_tri = [0.00101603, 0.000277795, 6.37774e-05, 1.4947e-05] rl2_euler_tri_pert = [0.00053851, 0.000121805, 2.67446e-05, 4.97857e-05] rl2_euler_tri_limited = [0.00234712, 0.000548344, 0.000139978, 3.56414e-05] rl2_euler_lp_tri_limited = [0.00242227, 0.000586065, 0.000140727] rl2_euler_limited = [0.00187271, 0.000435096, 0.000120633, 2.90233e-05] rl2_euler_lp_limited = [0.00180033, 0.000422567, 0.000120477, 2.90644e-05] rl2_ns = [0.000576472, 0.000132735, 7.0506e-05, 6.67272e-05] rl2_ns_fp = [abs(fp_actual - 0.008118), abs(fp_actual - 0.015667), abs(fp_actual - 0.026915), abs(fp_actual - 0.037524), abs(fp_actual - 0.042895)] print("rho euler l2: "+str(log(rl2_euler[2]/rl2_euler[3])/log(dx[2]/dx[3]))) print("rho euler tri l2: "+str(log(rl2_euler_tri[2]/rl2_euler_tri[3])/log(dx_tri[2]/dx_tri[3]))) print("rho euler tri perturbed l2: "+str(log(rl2_euler_tri_pert[1]/rl2_euler_tri_pert[2])/log(dx_pert[1]/dx_pert[2]))) print("rho euler tri limited l2: "+str(log(rl2_euler_tri_limited[2]/rl2_euler_tri_limited[3])/log(dx_tri[2]/dx_tri[3]))) print("rho euler lp tri limited l2: "+str(log(rl2_euler_lp_tri_limited[1]/rl2_euler_lp_tri_limited[2])/log(dx_tri[1]/dx_tri[2]))) print("rho euler limited l2: "+str(log(rl2_euler_limited[2]/rl2_euler_limited[3])/log(dx[2]/dx[3]))) print("rho euler lp limited l2: "+str(log(rl2_euler_lp_limited[2]/rl2_euler_lp_limited[3])/log(dx[2]/dx[3]))) print("rho ns l2: "+str(log(rl2_ns[0]/rl2_ns[1])/log(dx[0]/dx[1]))) print("rho ns end l2: "+str(log(rl2_ns[2]/rl2_ns[3])/log(dx[2]/dx[3]))) print("rho ns fp l2: "+str(log(rl2_ns_fp[0]/rl2_ns_fp[1])/log(dx_fp[0]/dx_fp[1]))) print("rho ns fp end l2: "+str(log(rl2_ns_fp[3]/rl2_ns_fp[4])/log(dx_fp[3]/dx_fp[4]))) plt.figure() hlines = plt.loglog(dx, rl2_euler, dx, rl2_ns, dx, rl2_euler_limited, dx, rl2_euler_lp_limited, dx_tri, rl2_euler_tri, dx_tri, rl2_euler_tri_limited, dx_pert[0:3], rl2_euler_tri_pert[0:3], dx_fp, rl2_ns_fp) plt.rc('text', usetex=True) plt.xlabel("Grid size") plt.ylabel("$L_2$ error") plt.legend(hlines, ["euler", "NS manufactured", "euler scalar limited", "euler lp limited", "euler tri", "euler tri limited", "euler tri pert", "NS flat plate"]) plt.grid(True,which="both") plt.show()<|fim▁end|>
<|file_name|>_define-length-compiled.js<|end_file_name|><|fim▁begin|>'use strict'; module.exports = function (t, a) { var foo = 'raz', bar = 'dwa', fn = function fn(a, b) { return this + a + b + foo + bar; }, result; result = t(fn, 3); a(result.call('marko', 'el', 'fe'), 'markoelferazdwa', "Content"); a(result.length, 3, "Length"); a(result.prototype, fn.prototype, "Prototype");<|fim▁hole|><|fim▁end|>
}; //# sourceMappingURL=_define-length-compiled.js.map
<|file_name|>optiondialog.hpp<|end_file_name|><|fim▁begin|>/* optiondialog.hpp * * Copyright (C) 2010 Martin Skowronski * * 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 2 of the License, or (at your option) * 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, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef OPTIONDIALOG_HPP #define OPTIONDIALOG_HPP #include <QDialog> namespace Ui { class OptionDialog;<|fim▁hole|>class OptionDialog : public QDialog { Q_OBJECT public: explicit OptionDialog(QWidget *parent = 0); ~OptionDialog(); private: Ui::OptionDialog *ui; }; #endif // OPTIONDIALOG_HPP<|fim▁end|>
}
<|file_name|>test-fs-write.js<|end_file_name|><|fim▁begin|>// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN<|fim▁hole|> // Flags: --expose_externalize_string 'use strict'; const common = require('../common'); const assert = require('assert'); const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const fn = path.join(tmpdir.path, 'write.txt'); const fn2 = path.join(tmpdir.path, 'write2.txt'); const fn3 = path.join(tmpdir.path, 'write3.txt'); const expected = 'ümlaut.'; const constants = fs.constants; /* eslint-disable no-undef */ common.allowGlobals(externalizeString, isOneByteString, x); { const expected = 'ümlaut eins'; // Must be a unique string. externalizeString(expected); assert.strictEqual(true, isOneByteString(expected)); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'latin1'); fs.closeSync(fd); assert.strictEqual(expected, fs.readFileSync(fn, 'latin1')); } { const expected = 'ümlaut zwei'; // Must be a unique string. externalizeString(expected); assert.strictEqual(true, isOneByteString(expected)); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'utf8'); fs.closeSync(fd); assert.strictEqual(expected, fs.readFileSync(fn, 'utf8')); } { const expected = '中文 1'; // Must be a unique string. externalizeString(expected); assert.strictEqual(false, isOneByteString(expected)); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'ucs2'); fs.closeSync(fd); assert.strictEqual(expected, fs.readFileSync(fn, 'ucs2')); } { const expected = '中文 2'; // Must be a unique string. externalizeString(expected); assert.strictEqual(false, isOneByteString(expected)); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'utf8'); fs.closeSync(fd); assert.strictEqual(expected, fs.readFileSync(fn, 'utf8')); } /* eslint-enable no-undef */ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { assert.ifError(err); const done = common.mustCall(function(err, written) { assert.ifError(err); assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); fs.unlinkSync(fn); assert.strictEqual(expected, found); }); const written = common.mustCall(function(err, written) { assert.ifError(err); assert.strictEqual(0, written); fs.write(fd, expected, 0, 'utf8', done); }); fs.write(fd, '', 0, 'utf8', written); })); const args = constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC; fs.open(fn2, args, 0o644, common.mustCall((err, fd) => { assert.ifError(err); const done = common.mustCall((err, written) => { assert.ifError(err); assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn2, 'utf8'); fs.unlinkSync(fn2); assert.strictEqual(expected, found); }); const written = common.mustCall(function(err, written) { assert.ifError(err); assert.strictEqual(0, written); fs.write(fd, expected, 0, 'utf8', done); }); fs.write(fd, '', 0, 'utf8', written); })); fs.open(fn3, 'w', 0o644, common.mustCall(function(err, fd) { assert.ifError(err); const done = common.mustCall(function(err, written) { assert.ifError(err); assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); }); fs.write(fd, expected, done); })); [false, 'test', {}, [], null, undefined].forEach((i) => { common.expectsError( () => fs.write(i, common.mustNotCall()), { code: 'ERR_INVALID_ARG_TYPE', type: TypeError } ); common.expectsError( () => fs.writeSync(i), { code: 'ERR_INVALID_ARG_TYPE', type: TypeError } ); });<|fim▁end|>
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE.
<|file_name|>RepositoryUtils.java<|end_file_name|><|fim▁begin|>package velir.intellij.cq5.util; import javax.jcr.Node; import javax.jcr.NodeIterator; import javax.jcr.RepositoryException; import javax.jcr.Session; import java.util.ArrayList; import java.util.List; /** * Utility class for helping work with Repository objects. */ public class RepositoryUtils { /** * Hide default constructor for true static class. */ private RepositoryUtils() { } public static List<String> getAllNodeTypeNames(Session session) throws RepositoryException { //get our child nodeTypes from our root NodeIterator nodeTypes = getAllNodeTypes(session); //go through each node type and pull out the name List<String> nodeTypeNames = new ArrayList<String>(); while (nodeTypes.hasNext()) { Node node = nodeTypes.nextNode(); nodeTypeNames.add(node.getName()); } //return our node type names return nodeTypeNames; } /** * Will get all the nodes that represent the different node types. * * @param session Repository session to use for pulling out this information. * @return<|fim▁hole|> Node nodeTypesRoot = session.getNode("/jcr:system/jcr:nodeTypes"); //get our child nodeTypes from our root return nodeTypesRoot.getNodes(); } }<|fim▁end|>
* @throws RepositoryException */ public static NodeIterator getAllNodeTypes(Session session) throws RepositoryException { //get our node types root
<|file_name|>symboltablemanager.cpp<|end_file_name|><|fim▁begin|>/* author: dongchangzhang */ /* time: Thu Apr 20 14:48:28 2017 */ #include "symboltablemanager.h" #include <iostream> SymbolTableManager::SymbolTableManager() { main_table = do_create_new_table(START_INDEX); cursor = main_table; } addr_type SymbolTableManager::install_id(const std::string& id) { return symbol_tables[cursor].install_id(id); } addr_type SymbolTableManager::install_value(int val) { return symbol_tables[cursor].install_value(val); } addr_type SymbolTableManager::install_value(char val) { return symbol_tables[cursor].install_value(val); } void SymbolTableManager::show_addr(addr_type& addr) { symbol_tables[cursor].show_addr(addr); } void SymbolTableManager::show_addr_content(addr_type& addr) { symbol_tables[cursor].show_addr_content(addr); }<|fim▁hole|>{ return symbol_tables[cursor].get_int(addr); } char SymbolTableManager::get_char(addr_type& addr) { return symbol_tables[cursor].get_char(addr); } void SymbolTableManager::declare_define_variable(int type, addr_type& addr_id) { addr_type addr; symbol_tables[cursor].declare_define_variable(type, addr_id, addr); } void SymbolTableManager::declare_define_variable(int type, addr_type& addr_id, addr_type& addr_value) { symbol_tables[cursor].declare_define_variable(type, addr_id, addr_value); } void SymbolTableManager::declare_array(int type, addr_type& addr_id, std::vector<int>& array_times) { symbol_tables[cursor].declare_array(type, addr_id, array_times); } addr_type SymbolTableManager::get_array_element_addr(addr_type& addr_id, std::vector<int>& array_times) { return symbol_tables[cursor].get_array_element_addr(addr_id, array_times); } void SymbolTableManager::variable_assignment(addr_type& id, addr_type& value) { symbol_tables[cursor].variable_assignment(id, value); } void SymbolTableManager::array_assignment(addr_type& id, addr_type& value) { symbol_tables[cursor].array_assignment(id, value); } void SymbolTableManager::value_assignment(addr_type& addr, int value) { symbol_tables[cursor].value_assignment(addr, value); } addr_type SymbolTableManager::conver_to_bool(addr_type& addr) { return symbol_tables[cursor].conver_to_bool(addr); }<|fim▁end|>
int SymbolTableManager::get_int(addr_type& addr)
<|file_name|>custom_association_rules.py<|end_file_name|><|fim▁begin|>import sys sys.path.append("..") from data_mining.association_rule.base import rules, lift, support from data_mining.association_rule.apriori import apriori from data_mining.association_rule.liftmin import apriorilift from pat_data_association_rules import compare LE = "leite" PA = "pao" SU = "suco" OV = "ovos"<|fim▁hole|>CA = "cafe" BI = "biscoito" AR = "arroz" FE = "feijao" CE = "cerveja" MA = "manteiga" data = [[CA, PA, MA], [LE, CE, PA, MA], [CA, PA, MA], [LE, CA, PA, MA], [CE], [MA], [PA], [FE], [AR, FE], [AR]] compare(data, 0.0000000001, 5.0, 0)<|fim▁end|>
<|file_name|>one.py<|end_file_name|><|fim▁begin|>""" 1.0 version of the API. """ from sharrock.descriptors import Descriptor version = '1.0' class MultiversionExample(Descriptor):<|fim▁hole|> """ This is the first version of this particular function. """<|fim▁end|>
<|file_name|>cmd_form.go<|end_file_name|><|fim▁begin|>package handler import ( "errors" "fmt" "html" "net/http" "strings" "github.com/HouzuoGuo/laitos/daemon/httpd/middleware" "github.com/HouzuoGuo/laitos/lalog" "github.com/HouzuoGuo/laitos/toolbox" ) const HandleCommandFormPage = `<html> <head> <title>Command Form</title> </head> <body> <form action="%s" method="post"> <p><input type="password" name="cmd" /><input type="submit" value="Exec"/></p> <pre>%s</pre> </form> </body> </html> ` // HandleCommandFormPage is the command form's HTML content // HTTPClienAppCommandTimeout is the timeout of app command execution in seconds shared by all capable HTTP endpoints. const HTTPClienAppCommandTimeout = 59 // Run feature commands in a simple web form. type HandleCommandForm struct { cmdProc *toolbox.CommandProcessor stripURLPrefixFromResponse string } func (form *HandleCommandForm) Initialise(_ lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error { if cmdProc == nil { return errors.New("HandleCommandForm.Initialise: command processor must not be nil") } if errs := cmdProc.IsSaneForInternet(); len(errs) > 0 { return fmt.Errorf("HandleCommandForm.Initialise: %+v", errs) } form.cmdProc = cmdProc form.stripURLPrefixFromResponse = stripURLPrefixFromResponse return nil } func (form *HandleCommandForm) Handle(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html") NoCache(w) if r.Method == http.MethodGet { _, _ = w.Write([]byte(fmt.Sprintf(HandleCommandFormPage, strings.TrimPrefix(r.RequestURI, form.stripURLPrefixFromResponse), ""))) } else if r.Method == http.MethodPost { if cmd := r.FormValue("cmd"); cmd == "" { _, _ = w.Write([]byte(fmt.Sprintf(HandleCommandFormPage, strings.TrimPrefix(r.RequestURI, form.stripURLPrefixFromResponse), ""))) } else { result := form.cmdProc.Process(r.Context(), toolbox.Command{ DaemonName: "httpd", ClientTag: middleware.GetRealClientIP(r), Content: cmd, TimeoutSec: HTTPClienAppCommandTimeout, }, true) _, _ = w.Write([]byte(fmt.Sprintf(HandleCommandFormPage, strings.TrimPrefix(r.RequestURI, form.stripURLPrefixFromResponse), html.EscapeString(result.CombinedOutput)))) } } } func (_ *HandleCommandForm) GetRateLimitFactor() int { return 1 } func (_ *HandleCommandForm) SelfTest() error { return nil<|fim▁hole|><|fim▁end|>
}
<|file_name|>passport.js<|end_file_name|><|fim▁begin|>/** * Passport configuration * * This is the configuration for your Passport.js setup and where you * define the authentication strategies you want your application to employ. * * I have tested the service with all of the providers listed below - if you * come across a provider that for some reason doesn't work, feel free to open * an issue on GitHub. * * Also, authentication scopes can be set through the `scope` property. * * For more information on the available providers, check out: * http://passportjs.org/guide/providers/ */ module.exports.passport = { local: { strategy: require('passport-local').Strategy }, bearer: { strategy: require('passport-http-bearer').Strategy } /*twitter: { name: 'Twitter', protocol: 'oauth', strategy: require('passport-twitter').Strategy, options: { consumerKey: 'your-consumer-key', consumerSecret: 'your-consumer-secret' } }, github: { name: 'GitHub', protocol: 'oauth2', strategy: require('passport-github').Strategy, options: { clientID: 'your-client-id', clientSecret: 'your-client-secret' } }, facebook: { name: 'Facebook', protocol: 'oauth2', strategy: require('passport-facebook').Strategy, options: { clientID: 'your-client-id', clientSecret: 'your-client-secret', scope: ['email'] } }, google: {<|fim▁hole|> protocol: 'oauth2', strategy: require('passport-google-oauth').OAuth2Strategy, options: { clientID: 'your-client-id', clientSecret: 'your-client-secret' } }, cas: { name: 'CAS', protocol: 'cas', strategy: require('passport-cas').Strategy, options: { ssoBaseURL: 'http://your-cas-url', serverBaseURL: 'http://localhost:1337', serviceURL: 'http://localhost:1337/auth/cas/callback' } }*/ };<|fim▁end|>
name: 'Google',
<|file_name|>long.serializer.inc.js<|end_file_name|><|fim▁begin|>module.exports = function ({ serializers, $lookup }) { serializers.inc.object = function () { return function (object, $step = 0) { let $_, $bite return function $serialize ($buffer, $start, $end) { switch ($step) { case 0: $step = 1 $bite = 7n $_ = object.value case 1: while ($bite != -1n) { if ($start == $end) { return { start: $start, serialize: $serialize } } $buffer[$start++] = Number($_ >> $bite * 8n & 0xffn) $bite-- } $step = 2 case 2: break } <|fim▁hole|>}<|fim▁end|>
return { start: $start, serialize: null } } } } ()
<|file_name|>test_visitors.py<|end_file_name|><|fim▁begin|>"""Unit-tests for `tree.visitors` """ from py2c import tree from py2c.tree import visitors from py2c.tests import Test, data_driven_test from nose.tools import assert_equal # TEST:: Add non-node fields # ============================================================================= # Helper classes # ============================================================================= class BasicNode(tree.Node): _fields = [] class BasicNodeReplacement(tree.Node): _fields = [] class BasicNodeWithListReplacement(tree.Node): _fields = [] class BasicNodeDeletable(tree.Node): _fields = [] class ParentNode(tree.Node): _fields = [ ('child', tree.Node, 'OPTIONAL'), ] class ParentNodeWithChildrenList(tree.Node): """Node with list of nodes as field """ _fields = [ ('child', tree.Node, 'ZERO_OR_MORE'), ] # ----------------------------------------------------------------------------- # Concrete Visitors used for testing # ----------------------------------------------------------------------------- class VisitOrderCheckingVisitor(visitors.RecursiveNodeVisitor): def __init__(self): super().__init__() self.visited = [] def generic_visit(self, node): self.visited.append(node.__class__.__name__) super().generic_visit(node) def visit_BasicNodeReplacement(self, node): self.visited.append("visited Copy!") class AccessPathCheckingVisitor(visitors.RecursiveNodeVisitor): def __init__(self): super().__init__() self.recorded_access_path = None def visit_BasicNode(self, node): self.recorded_access_path = self.access_path[:] class EmptyTransformer(visitors.RecursiveNodeTransformer): pass class VisitOrderCheckingTransformer(visitors.RecursiveNodeTransformer): def __init__(self): super().__init__() self.visited = [] def generic_visit(self, node): self.visited.append(node.__class__.__name__) return super().generic_visit(node) def visit_BasicNodeReplacement(self, node): self.visited.append("visited Copy!") return node class AccessPathCheckingTransformer(visitors.RecursiveNodeTransformer): def __init__(self): super().__init__() self.recorded_access_path = None def visit_BasicNode(self, node): self.recorded_access_path = self.access_path[:] return node class TransformationCheckingTransformer(visitors.RecursiveNodeTransformer): def visit_BasicNode(self, node): return BasicNodeReplacement() def visit_BasicNodeDeletable(self, node): return None # Delete this node def visit_BasicNodeReplacement(self, node): return self.NONE_DEPUTY # Replace this node with None def visit_BasicNodeWithListReplacement(self, node): return [BasicNode(), BasicNodeReplacement()] # ----------------------------------------------------------------------------- # Tests # ----------------------------------------------------------------------------- class TestRecursiveASTVisitor(Test): """py2c.tree.visitors.RecursiveNodeVisitor """ context = globals() @data_driven_test("visitors-visitor_order.yaml", prefix="visit order of ") def test_visit_order(self, node, order): to_visit = self.load(node)<|fim▁hole|> # The main stuff visitor = VisitOrderCheckingVisitor() retval = visitor.visit(to_visit) assert_equal(retval, None) assert_equal(visitor.visited, order) @data_driven_test("visitors-access_path.yaml", prefix="access path on visit of ") def test_access_path(self, node, access): to_visit = self.load(node) access_path = self.load(access) # The main stuff visitor = AccessPathCheckingVisitor() retval = visitor.visit(to_visit) assert_equal(retval, None) assert_equal(visitor.recorded_access_path, access_path) class TestRecursiveASTTransformer(Test): """py2c.tree.visitors.RecursiveNodeTransformer """ context = globals() @data_driven_test("visitors-visitor_order.yaml", prefix="empty transformer does not transform ") def test_empty_transformer(self, node, order): to_visit = self.load(node) # The main stuff visitor = EmptyTransformer() retval = visitor.visit(to_visit) assert_equal(to_visit, retval) @data_driven_test("visitors-visitor_order.yaml", prefix="visit order of ") def test_visit_order(self, node, order): to_visit = self.load(node) # The main stuff visitor = VisitOrderCheckingTransformer() retval = visitor.visit(to_visit) assert_equal(to_visit, retval) assert_equal(visitor.visited, order) @data_driven_test("visitors-access_path.yaml", prefix="access path on visit of ") def test_access_path(self, node, access): to_visit = self.load(node) access_path = self.load(access) # The main stuff visitor = AccessPathCheckingTransformer() retval = visitor.visit(to_visit) assert_equal(retval, to_visit) assert_equal(visitor.recorded_access_path, access_path) @data_driven_test("visitors-transform.yaml", prefix="transformation of ") def test_transformation(self, node, expected): to_visit = self.load(node) expected_node = self.load(expected) # The main stuff visitor = TransformationCheckingTransformer() retval = visitor.visit(to_visit) assert_equal(retval, expected_node) if __name__ == '__main__': from py2c.tests import runmodule runmodule()<|fim▁end|>
<|file_name|>package-info.java<|end_file_name|><|fim▁begin|>// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. <|fim▁hole|>@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.opengis.net/kml/2.2", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package hortonworks.hdp.refapp.trucking.simulator.impl.domain.transport.route.jaxb;<|fim▁end|>
// Generated on: 2014.05.14 at 05:14:09 PM CDT //
<|file_name|>relaycontrol.py<|end_file_name|><|fim▁begin|>import paho.mqtt.client as mqtt import json, time import RPi.GPIO as GPIO from time import sleep # The script as below using BCM GPIO 00..nn numbers GPIO.setmode(GPIO.BCM) # Set relay pins as output GPIO.setup(24, GPIO.OUT) # ----- CHANGE THESE FOR YOUR SETUP ----- MQTT_HOST = "190.97.168.236" MQTT_PORT = 1883 USERNAME = '' PASSWORD = "" # --------------------------------------- def on_connect(client, userdata, rc):<|fim▁hole|> #Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. client.subscribe("/iot/control/") print("Subscribed to iotcontrol") def on_message_iotrl(client, userdata, msg): print("\n\t* Raspberry UPDATED ("+msg.topic+"): " + str(msg.payload)) if msg.payload == "gpio24on": GPIO.output(24, GPIO.HIGH) client.publish("/iot/status", "Relay gpio18on", 2) if msg.payload == "gpio24off": GPIO.output(24, GPIO.LOW) client.publish("/iot/status", "Relay gpio18off", 2) def command_error(): print("Error: Unknown command") client = mqtt.Client(client_id="rasp-g1") # Callback declarations (functions run based on certain messages) client.on_connect = on_connect client.message_callback_add("/iot/control/", on_message_iotrl) # This is where the MQTT service connects and starts listening for messages client.username_pw_set(USERNAME, PASSWORD) client.connect(MQTT_HOST, MQTT_PORT, 60) client.loop_start() # Background thread to call loop() automatically # Main program loop while True: time.sleep(10)<|fim▁end|>
print("\nConnected with result code " + str(rc) + "\n")
<|file_name|>transit.rs<|end_file_name|><|fim▁begin|>#[derive(Debug, Clone)] pub struct Transit {<|fim▁hole|> duration: f64, decay: f64, phase: f64, } impl Transit { pub fn new((period, base, depth, duration, decay, phase): (f64,f64,f64,f64,f64,f64)) -> Transit { Transit { period, base, depth, duration, decay, phase } } pub fn value(&self, time: &f64) -> f64 { let k = (time/self.period).floor(); let t = time - k * self.period; if t < self.phase { self.base } else if t < (self.phase + self.decay) { let start = self.phase; let f = (t - start) / self.decay; self.base - f * self.depth } else if t < (self.phase + self.decay + self.duration) { self.base - self.depth } else if t < (self.phase + self.decay + self.duration + self.decay) { let start = self.phase + self.decay + self.duration; let f = (t - start) / self.decay; self.base - (1f64 - f) * self.depth } else { self.base } } }<|fim▁end|>
period: f64, base: f64, depth: f64,
<|file_name|>name.py<|end_file_name|><|fim▁begin|>from operator import attrgetter from plyj.model.source_element import Expression from plyj.utility import assert_type class Name(Expression): simple = property(attrgetter("_simple")) value = property(attrgetter("_value")) def __init__(self, value): """ Represents a name. :param value: The name. """ super(Name, self).__init__() self._fields = ['value'] self._value = None self._simple = False self.value = value @value.setter def value(self, value): self._value = assert_type(value, str) self._simple = "." not in value def append_name(self, name):<|fim▁hole|> else: self._value = self._value + '.' + name @staticmethod def ensure(se, simple): if isinstance(se, str): return Name(se) if not isinstance(se, Name): raise TypeError("Required Name, got \"{}\"".format(str(type(se)))) if simple and not se.simple: raise TypeError("Required simple Name, got complex Name") return se def serialize(self): return self.value<|fim▁end|>
self._simple = False if isinstance(name, Name): self._value = self._value + '.' + name._value
<|file_name|>TestNativeAtanh.rs<|end_file_name|><|fim▁begin|>/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma version(1) #pragma rs java_package_name(android.renderscript.cts) // Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime. float __attribute__((kernel)) testNativeAtanhFloatFloat(float inIn) { return native_atanh(inIn); } float2 __attribute__((kernel)) testNativeAtanhFloat2Float2(float2 inIn) { return native_atanh(inIn);<|fim▁hole|>} float3 __attribute__((kernel)) testNativeAtanhFloat3Float3(float3 inIn) { return native_atanh(inIn); } float4 __attribute__((kernel)) testNativeAtanhFloat4Float4(float4 inIn) { return native_atanh(inIn); }<|fim▁end|>
<|file_name|>segaxbd.cpp<|end_file_name|><|fim▁begin|>// license:BSD-3-Clause // copyright-holders:Aaron Giles /*************************************************************************** Sega X-board hardware Special thanks to Charles MacDonald for his priceless assistance **************************************************************************** Known bugs: * gprider has a hack to make it work * smgp network and motor boards not hooked up * rachero doesn't like IC17/IC108 (divide chips) in self-test due to testing an out-of-bounds value * abcop doesn't like IC41/IC108 (divide chips) in self-test due to testing an out-of-bounds value * rascot is not working at all Sega X-Board System Overview Sega, 1987-1992 The following games are known to exist on the X-Board hardware... AB Cop (C) Sega 1990 After Burner (C) Sega 1987 After Burner II (C) Sega 1987 *Caribbean Boule (C) Sega 1992 GP Rider (C) Sega 1990 Last Survivor (C) Sega 1989 Line of Fire (C) Sega 1989 Racing Hero (C) Sega 1990 Royal Ascot (C) Sega 1991 dumped, but very likely incomplete Super Monaco GP (C) Sega 1989 Thunder Blade (C) Sega 1987 * denotes not dumped. There are also several revisions of the above games not dumper either. Main Board ---------- Top : 834-6335 Bottom : 171-5494 Sticker: 834-7088-01 REV. B SUPER MONACO GP Sticker: 834-6335-02 AFTER BURNER |-----------------------------------------------------------------------------| |IC67 IC66 IC65 IC64 IC58 IC57 IC56 IC55 BATT CNH 16MHz CNA CNE CNF | |IC71 IC70 IC69 IC68 IC107 IC15 IC11 IC7 IC5 IC1 | |IC75 IC74 IC73 IC72 IC16 IC12 IC8 IC6 IC2 | |IC79 IC78 IC77 IC76 IC63 IC62 IC61 IC60 IC108 IC17 IC13 IC10 IC9 IC3 | | IC18 IC14 | | | | | | IC84 IC81 | | IC23 | | IC22 | | IC109 IC21 IC20| | IC125 IC118 IC28 IC30 IC29| |IC93 IC92 IC91 IC90 IC126 IC31 | | IC53 IC32 | | IC32* IC40 IC38 | | IC33* IC39 CNI| |IC97 IC96 IC95 IC94 IC127 IC117 | | IC134 | | IC135 50MHz | | IC37 | |IC101 IC100 IC99 IC98 IC148 | | IC165 | | IC42 | | IC150 IC170 IC41 | |IC105 IC104 IC103 IC102 | | IC154 IC152 IC160 IC159 DIPSWB DIPSWA| | IC153 IC151 IC149 CNG CNB CNC CND | |-----------------------------------------------------------------------------| Notes: ROMs: (ROM locations on the PCB not listed are not populated) Type (note 1) 27C1000 27C1000 27C1000 27C1000 27C1000 27C1000 27C1000 27C1000 27C512 27C512 27C512 831000 831000 831000 831000 831000 831000 831000 831000 831000 831000 831000 831000 27C1000 27C1000 27C1000 27C1000 27C512 27C512 831000 831000 831000 Location IC58 IC63 IC57 IC62 IC20 IC29 IC21 IC30 IC154 IC153 IC152 IC90 IC94 IC98 IC102 IC91 IC95 IC99 IC103 IC92 IC96 IC100 IC104 IC93 IC97 IC101 IC105 IC40 IC17 IC11 IC12 IC13 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- After Burner EPR-10940 EPR-10941 - - EPR-10927 EPR-10928 - - EPR-10926 EPR-10925 EPR-10924 MPR-10932 MPR-10934 MPR-10936 MPR-10938 MPR-10933 MPR-10935 MPR-10937 MPR-10939 EPR-10942 EPR-10943 EPR-10944 EPR-10945 EPR-10946 EPR-10947 EPR-10948 EPR-10949 EPR-10922 MPR-10923 MPR-10930 MPR-10931 MPR-11102 After Burner 2 EPR-11107 EPR-11108 - - EPR-11109 EPR-11110 - - EPR-11115 EPR-11114 EPR-11113 MPR-10932 MPR-10934 MPR-10936 MPR-10938 MPR-10933 MPR-10935 MPR-10937 MPR-10939 MPR-11103 MPR-11104 MPR-11105 MPR-11106 EPR-11116 EPR-11117 EPR-11118 EPR-11119 EPR-10922 EPR-11112 MPR-10930 MPR-10931 EPR-11102 Line Of Fire (set 3) EPR-12849 EPR-12850 - - EPR-12804 EPR-12805 EPR-12802 EPR-12803 OPR-12791 OPR-12792 OPR-12793 EPR-12787 EPR-12788 EPR-12789 EPR-12790 EPR-12783 EPR-12784 EPR-12785 EPR-12786 EPR-12779 EPR-12780 EPR-12781 EPR-12782 EPR-12775 EPR-12776 EPR-12777 EPR-12778 - EPR-12798 EPR-12799 EPR-12800 EPR-12801 Line Of Fire (set 2) EPR-12847A EPR-12848A - - EPR-12804 EPR-12805 EPR-12802 EPR-12803 OPR-12791 OPR-12792 OPR-12793 EPR-12787 EPR-12788 EPR-12789 EPR-12790 EPR-12783 EPR-12784 EPR-12785 EPR-12786 EPR-12779 EPR-12780 EPR-12781 EPR-12782 EPR-12775 EPR-12776 EPR-12777 EPR-12778 - EPR-12798 EPR-12799 EPR-12800 EPR-12801 Line Of Fire (set 1) EPR-12794 EPR-12795 - - EPR-12804 EPR-12805 EPR-12802 EPR-12803 OPR-12791 OPR-12792 OPR-12793 EPR-12787 EPR-12788 EPR-12789 EPR-12790 EPR-12783 EPR-12784 EPR-12785 EPR-12786 EPR-12779 EPR-12780 EPR-12781 EPR-12782 EPR-12775 EPR-12776 EPR-12777 EPR-12778 - EPR-12798 EPR-12799 EPR-12800 EPR-12801 Thunder Blade (set 2) EPR-11405 EPR-11406 EPR-11306 EPR-11307 EPR-11390 EPR-11391 EPR-11310 EPR-11311 EPR-11314 EPR-11315 EPR-11316 EPR-11323 EPR-11322 EPR-11321 EPR-11320 EPR-11327 EPR-11326 EPR-11325 EPR-11324 EPR-11331 EPR-11330 EPR-11329 EPR-11328 EPR-11395 EPR-11394 EPR-11393 EPR-11392 EPR-11313 EPR-11396 EPR-11317 EPR-11318 EPR-11319 Thunder Blade (set 1) EPR-11304 EPR-11305 EPR-11306 EPR-11307 EPR-11308 EPR-11309 EPR-11310 EPR-11311 EPR-11314 EPR-11315 EPR-11316 EPR-11323 EPR-11322 EPR-11321 EPR-11320 EPR-11327 EPR-11326 EPR-11325 EPR-11324 EPR-11331 EPR-11330 EPR-11329 EPR-11328 EPR-11335 EPR-11334 EPR-11333 EPR-11332 EPR-11313 EPR-11312 EPR-11317 EPR-11318 EPR-11319 Racing Hero EPR-13129 EPR-13130 EPR-12855 EPR-12856 EPR-12857 EPR-12858 - - EPR-12879 EPR-12880 EPR-12881 EPR-12872 EPR-12873 EPR-12874 EPR-12875 EPR-12868 EPR-12869 EPR-12870 EPR-12871 EPR-12864 EPR-12865 EPR-12866 EPR-12867 EPR-12860 EPR-12861 EPR-12862 EPR-12863 - EPR-12859 EPR-12876 EPR-12877 EPR-12878 S.Monaco GP (set 9) EPR-12563B EPR-12564B - - EPR-12576A EPR-12577A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 8) EPR-12563A EPR-12564A - - EPR-12576A EPR-12577A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 7) EPR-12563 EPR-12564 - - EPR-12576 EPR-12577 - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 6) EPR-12561C EPR-12562C - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 5) EPR-12561B EPR-12562B - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 4) EPR-12561A EPR-12562A - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 3) EPR-12561 EPR-12562 - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 2) EPR-12432B EPR-12433B - - EPR-12441A EPR-12442A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12413 EPR-12414 EPR-12415 EPR-12416 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 S.Monaco GP (set 1) EPR-12432A EPR-12433A - - EPR-12441A EPR-12442A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12413 EPR-12414 EPR-12415 EPR-12416 - EPR-12436 MPR-12437 MPR-12438 MPR-12439 AB Cop EPR-13568B EPR-13556B EPR-13559 EPR-13558 EPR-13566 EPR-13565 - - OPR-13553 OPR-13554 OPR-13555 OPR-13552 OPR-13551 OPR-13550 OPR-13549 OPR-13548 OPR-13547 OPR-13546 OPR-13545 OPR-13544 OPR-13543 OPR-13542 OPR-13541 OPR-13540 OPR-13539 OPR-13538 OPR-13537 EPR-13564 EPR-13560 OPR-13563 OPR-13562 OPR-13561 GP Rider (set 2) EPR-13408 EPR-13409 - - EPR-13395 EPR-13394 EPR-13393 EPR-13392 EPR-13383 EPR-13384 EPR-13385 EPR-13382 EPR-13381 EPR-13380 EPR-13379 EPR-13378 EPR-13377 EPR-13376 EPR-13375 EPR-13374 EPR-13373 EPR-13372 EPR-13371 EPR-13370 EPR-13369 EPR-13368 EPR-13367 - EPR-13388 EPR-13391 EPR-13390 EPR-13389 GP Rider (set 1) EPR-13406 EPR-13407 - - EPR-13395 EPR-13394 EPR-13393 EPR-13392 EPR-13383 EPR-13384 EPR-13385 EPR-13382 EPR-13381 EPR-13380 EPR-13379 EPR-13378 EPR-13377 EPR-13376 EPR-13375 EPR-13374 EPR-13373 EPR-13372 EPR-13371 EPR-13370 EPR-13369 EPR-13368 EPR-13367 - EPR-13388 EPR-13391 EPR-13390 EPR-13389 Note 1 - PCB can handle 27C1000 / 27C010 / 831000 ROMs via jumpers If label = EPR, ROM is 32 pin 27C1000 or 27C010 If label = MPR, ROM is 28 pin 831000 For jumper settings, 27C1000 also means 831000 can be used S28 shorted, S26 open = ROMS 90-103 (Groups 1,2) use 831000 S28 open, S26 shorted = ROMS 90-103 (Groups 1,2) use 27C010 S29 shorted, S27 open = ROMS 90-103 (Groups 3,4) use 831000 S29 open, S27 shorted = ROMS 92-105 (Groups 3,4) use 27C010 For IC11/12/13, set jumpers S1 open, S2 resistor, S3 open, S4 resistor for 27C1000. Reverse them for 27C010 For IC20/29 set jumpers S5 resistor, S6 open, S7 resistor, S8 open for 27C1000. Reverse them for 27C010 For IC21/30 set jumpers S9 resistor, S10 open, S11 resistor, S12 open for 27C1000. Reverse them for 27C010 For IC57/62 set jumpers S18 resistor, S19 open, S20 resistor, S21 open for 27C1000. Reverse them for 27C010 For IC58/63 set jumpers S22 resistor, S23 open, S24 resistor, S25 open for 27C1000. Reverse them for 27C010 For IC40 set jumpers S13 open, S14 resistor to set 27C512. Reverse them for 27C256 For IC152/153/154 set jumpers S31 open, S32 resistor to set 27C512. Reverse them for 27C256 PALs: (Common to all games except where noted) IC18 : 315-5280 (= CK2605 == PLS153) - Z80 address decoding IC84 : 315-5278 (= PAL16L8) - Sprite ROM bank control IC109: 315-5290 (= PAL16L8) - Main CPU address decoding IC117: 315-5291 (= PAL16L8) - Main CPU address decoding IC127: After Burner - 315-5279 (= PAL16R6) S.Monaco GP - 315-5304 (= PAL16R6) GP Rider - 315-5304 (= PAL16R6) Line Of Fire - 315-5304 (= PAL16R6) There could be other different ones or maybe there's just 2 types? RAM: IC9 : 6116 (2k x8 SRAM) - Sega PCM chip RAM. == TMM2115 IC10 : 6116 (2k x8 SRAM) - Sega PCM chip RAM IC16 : 6116 (2k x8 SRAM) - Z80 program RAM IC22 : 6264 (8k x8 SRAM) - Sub CPU Program RAM. == Sony CXK5864 or Fujitsu MB8464 or NEC D4364 IC23 : 6264 (8k x8 SRAM) - Sub CPU Program RAM IC31 : 6116 (2k x8 SRAM) - Sub CPU Program RAM IC32 : 6116 (2k x8 SRAM) - Sub CPU Program RAM IC38 : 6264 (8k x8 SRAM) - Road RAM IC39 : 6264 (8k x8 SRAM) - Road RAM IC55 : 6264 (8k x8 SRAM) - Main CPU Program RAM IC56 : 6264 (8k x8 SRAM) - Main CPU Program RAM IC60 : 6264 (8k x8 SRAM) - Main CPU Program RAM IC61 : 6264 (8k x8 SRAM) - Main CPU Program RAM IC64 : TC51832 (32k x8 SRAM) - Sprite GFX RAM. == NEC uPD42832 IC65 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC66 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC67 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC68 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC69 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC70 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC71 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC72 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC73 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC74 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC75 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC76 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC77 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC78 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC79 : TC51832 (32k x8 SRAM) - Sprite GFX RAM IC125: MB81C78 (8k x8 SRAM) - IC126: MB81C78 (8k x8 SRAM) - IC132: 6264 (8k x8 SRAM) - Text RAM. \ * On this PCB these are mis-labelled as IC32 and IC33 IC133: 6264 (8k x8 SRAM) - Text RAM / IC134: 62256 (32k x8 SRAM) - Tile / Background GFX RAM IC135: 62256 (32k x8 SRAM) - Tile / Background GFX RAM IC150: 6264 (8k x8 SRAM) - IC151: 6264 (8k x8 SRAM) - SEGA Custom ICs: IC8 : 315-5218 (QFP100) - Sega Stereo PCM Sound IC with 16 channels. Clock input 16.000MHz IC37 : 315-5248 (QFP100) - Hardware multiplier IC41 : 315-5249 (QFP120) - Hardware divider IC42 : 315-5275 (QFP100) - Road generator, located underneath the PCB IC53 : 315-5250 (QFP120) - 68000 / Z80 interface, hardware comparator IC81 : 315-5211A (PGA179) - Sprite Generator IC107: 315-5248 (QFP100) - Hardware multiplier IC108: 315-5249 (QFP120) - Hardware divider IC148: 315-5197 (PGA135) - Tilemap generator (for Backgrounds) IC149: 315-5242 (Custom) - Color Encoder. Custom ceramic DIP package. Contains a QFP44 and some smt resistors/caps etc OTHER: IC14 : Z80 CPU, clock 4.000MHz [16/4] (DIP40) IC15 : YM2151, clock 4.000MHz [16/4] (DIP24) IC28 : 68000 CPU (sub), clock 12.5000MHz [50/4] (DIP64) IC118: Hitachi FD1094 Encrypted 68000 CPU or regular 68000 CPU (main), clock 12.5000MHz [50/4] (DIP64) IC159: SONY CXD1095 CMOS I/O Port Expander (QFP64) IC160: SONY CXD1095 CMOS I/O Port Expander (QFP64) IC165: ADC0804, for control of analog inputs (DIP20) IC170: Fujitsu MB3773 Reset IC (DIP8) IC1 : NEC uPC324 Low Power Quad Operational Amplifier (DIP14) IC2 : NEC uPC4082 J-FET Dual Input Operational Amplifier (DIP8) IC3 : Yamaha YM3012 Sound Digital to Analog Converter (DIP16) IC5 : M8736 MF6CN-50 (DIP14) IC6 : M8736 MF6CN-50 (DIP14) IC7 : Exar MP7633JN CMOS 10-Bit Multiplying Digital to Analog Converter (== AD7533 / AD7530 / AD7520) (DIP16) BATT : 5.5 volt 0.1uF Super Cap CNA : 10 pin +5V / GND Power Connector CNB : 20 pin Analog Controls Connector CNC : 26 pin Connector for ? CND : 50 pin Digital Controls/Buttons Connector CNE : 6 pin Connector for ? CNF : 4 pin Stereo Sound Output Connector CNG : 6 pin RGB/Sync/GND Connector CNH : 10 pin Connector for ? CNI : 30 pin Expansion Connector (not populated) VSync: 59.6368Hz \ (measured via EL4583 & TTi PFM1300) HSync: 15.5645kHz / Add-on boards for Super Monaco GP --------------------------------- Super Monaco GP was released as upright, twin, cockpit, and deluxe 'Air Drive'. DIP switches determine the cabinet type. It is presumed that these extra boards can be interchanged. Network Board (twin cabinet) ------------- Top : 834-6780 Bottom : 171-5729-01 Sticker: 834-7112 |---------| |--| |----------------------| | RX TX 315-5336 | | 315-5337 | | | | 16MHz 6264 | | epr-12587.14 | | MB89372P-SH Z80E MB8421 | |---------------------------------------| Notes: PALs : 315-5337, 315-5336, both PAL16L8 Z80 clock: 8.000MHz [16/2] 6264 : 8k x8 SRAM MB8421 : Fujitsu 2k x8 Dual-Port SRAM (SDIP52) MB89372 : Fujitsu Multi-Protocol Controller (SDIP64) epr-12587: 27C256 EPROM Sound Board (for 4-channel sound, cockpit and deluxe cabinets) ------------- label: 837-7000 Z80 (assume 4MHz) Sega 315-5218 sound IC ROMs: - epr-12535.8 - mpr-12437.20 - mpr-12438.21 - mpr-12439.22 Motor Board (deluxe cabinet) ------------- label: ? Z80 (unknown speed) ROMs: - epr-12505.8 ***************************************************************************/ #include "emu.h" #include "includes/segaxbd.h" #include "machine/nvram.h" #include "sound/ym2151.h" #include "sound/segapcm.h" #include "includes/segaipt.h" const device_type SEGA_XBD_PCB = &device_creator<segaxbd_state>; segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, SEGA_XBD_PCB, "Sega X-Board PCB", tag, owner, clock, "segaxbd_pcb", __FILE__), m_maincpu(*this, "maincpu"), m_subcpu(*this, "subcpu"), m_soundcpu(*this, "soundcpu"), m_soundcpu2(*this, "soundcpu2"), m_mcu(*this, "mcu"), m_watchdog(*this, "watchdog"), m_cmptimer_1(*this, "cmptimer_main"), m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), m_segaic16road(*this, "segaic16road"), m_soundlatch(*this, "soundlatch"), m_subram0(*this, "subram0"), m_road_priority(1), m_scanline_timer(nullptr), m_timer_irq_state(0), m_vblank_irq_state(0), m_loffire_sync(nullptr), m_lastsurv_mux(0), m_paletteram(*this, "paletteram"), m_gprider_hack(false), m_palette_entries(0), m_screen(*this, "screen"), m_palette(*this, "palette"), m_adc_ports(*this, {"ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6", "ADC7"}), m_mux_ports(*this, {"MUX0", "MUX1", "MUX2", "MUX3"}) { memset(m_adc_reverse, 0, sizeof(m_adc_reverse)); memset(m_iochip_regs, 0, sizeof(m_iochip_regs)); palette_init(); } void segaxbd_state::device_start() { if(!m_segaic16road->started()) throw device_missing_dependencies(); // point globals to allocated memory regions m_segaic16road->segaic16_roadram_0 = reinterpret_cast<UINT16 *>(memshare("roadram")->ptr()); video_start(); // allocate a scanline timer m_scanline_timer = timer_alloc(TID_SCANLINE); // reset the custom handlers and other pointers m_iochip_custom_io_w[0][3] = iowrite_delegate(FUNC(segaxbd_state::generic_iochip0_lamps_w), this); // save state save_item(NAME(m_timer_irq_state)); save_item(NAME(m_vblank_irq_state)); save_item(NAME(m_iochip_regs[0])); save_item(NAME(m_iochip_regs[1])); save_item(NAME(m_lastsurv_mux)); } void segaxbd_state::device_reset() { m_segaic16vid->tilemap_reset(*m_screen); // hook the RESET line, which resets CPU #1 m_maincpu->set_reset_callback(write_line_delegate(FUNC(segaxbd_state::m68k_reset_callback),this)); // start timers to track interrupts m_scanline_timer->adjust(m_screen->time_until_pos(1), 1); } class segaxbd_new_state : public driver_device { public: segaxbd_new_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_mainpcb(*this, "mainpcb") { } required_device<segaxbd_state> m_mainpcb; // game-specific driver init DECLARE_DRIVER_INIT(generic); DECLARE_DRIVER_INIT(aburner2); DECLARE_DRIVER_INIT(lastsurv); DECLARE_DRIVER_INIT(loffire); DECLARE_DRIVER_INIT(smgp); DECLARE_DRIVER_INIT(rascot); DECLARE_DRIVER_INIT(gprider); }; class segaxbd_new_state_double : public segaxbd_new_state { public: segaxbd_new_state_double(const machine_config &mconfig, device_type type, const char *tag) : segaxbd_new_state(mconfig, type, tag), m_subpcb(*this, "subpcb") { for (auto & elem : shareram) { elem = 0x0000; } rampage1 = 0x0000; rampage2 = 0x0000; } required_device<segaxbd_state> m_subpcb; DECLARE_READ16_MEMBER(shareram1_r) { if (offset < 0x10) { int address = (rampage1 << 4) + offset; return shareram[address]; } return 0xffff; } DECLARE_WRITE16_MEMBER(shareram1_w) { if (offset < 0x10) { int address = (rampage1 << 4) + offset; COMBINE_DATA(&shareram[address]); } else if (offset == 0x10) { rampage1 = data & 0x00FF; } } DECLARE_READ16_MEMBER(shareram2_r) { if (offset < 0x10) { int address = (rampage2 << 4) + offset; return shareram[address]; } return 0xffff; } DECLARE_WRITE16_MEMBER(shareram2_w) { if (offset < 0x10) { int address = (rampage2 << 4) + offset; COMBINE_DATA(&shareram[address]); } else if (offset == 0x10) { rampage2 = data & 0x007F; } } DECLARE_DRIVER_INIT(gprider_double); UINT16 shareram[0x800]; UINT16 rampage1; UINT16 rampage2; }; //************************************************************************** // CONSTANTS //************************************************************************** const UINT32 MASTER_CLOCK = XTAL_50MHz; const UINT32 SOUND_CLOCK = XTAL_16MHz; //************************************************************************** // COMPARE/TIMER CHIP CALLBACKS //************************************************************************** //------------------------------------------------- // timer_ack_callback - acknowledge a timer chip // interrupt signal //------------------------------------------------- void segaxbd_state::timer_ack_callback() { // clear the timer IRQ m_timer_irq_state = 0; update_main_irqs(); } //------------------------------------------------- // sound_data_w - write data to the sound CPU //------------------------------------------------- void segaxbd_state::sound_data_w(UINT8 data) { synchronize(TID_SOUND_WRITE, data); } //************************************************************************** // MAIN CPU READ/WRITE CALLBACKS //************************************************************************** //------------------------------------------------- // adc_w - handle reads from the ADC //------------------------------------------------- READ16_MEMBER( segaxbd_state::adc_r ) { // on the write, latch the selected input port and stash the value int which = (m_iochip_regs[0][2] >> 2) & 7; int value = m_adc_ports[which].read_safe(0x0010); // reverse some port values if (m_adc_reverse[which]) value = 255 - value; // return the previously latched value return value; } //------------------------------------------------- // adc_w - handle writes to the ADC //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::adc_w ) { } //------------------------------------------------- // iochip_r - helper to handle I/O chip reads //------------------------------------------------- inline UINT16 segaxbd_state::iochip_r(int which, int port, int inputval) { UINT16 result = m_iochip_regs[which][port]; // if there's custom I/O, do that to get the input value if (!m_iochip_custom_io_r[which][port].isnull()) inputval = m_iochip_custom_io_r[which][port](inputval); // for ports 0-3, the direction is controlled 4 bits at a time by register 6 if (port <= 3) { if ((m_iochip_regs[which][6] >> (2 * port + 0)) & 1) result = (result & ~0x0f) | (inputval & 0x0f); if ((m_iochip_regs[which][6] >> (2 * port + 1)) & 1) result = (result & ~0xf0) | (inputval & 0xf0); } // for port 4, the direction is controlled 1 bit at a time by register 7 else { if ((m_iochip_regs[which][7] >> 0) & 1) result = (result & ~0x01) | (inputval & 0x01); if ((m_iochip_regs[which][7] >> 1) & 1) result = (result & ~0x02) | (inputval & 0x02); if ((m_iochip_regs[which][7] >> 2) & 1) result = (result & ~0x04) | (inputval & 0x04); if ((m_iochip_regs[which][7] >> 3) & 1) result = (result & ~0x08) | (inputval & 0x08); result &= 0x0f; } return result; } //------------------------------------------------- // iochip_0_r - handle reads from the first I/O // chip //------------------------------------------------- READ16_MEMBER( segaxbd_state::iochip_0_r ) { switch (offset) { case 0: // Input port: // D7: (Not connected) // D6: /INTR of ADC0804 // D5-D0: CN C pin 24-19 (switch state 0= open, 1= closed) return iochip_r(0, 0, ioport("IO0PORTA")->read()); case 1: // I/O port: CN C pins 17,15,13,11,9,7,5,3 return iochip_r(0, 1, ioport("IO0PORTB")->read()); case 2: // Output port return iochip_r(0, 2, 0); case 3: // Output port return iochip_r(0, 3, 0); case 4: // Unused return iochip_r(0, 4, 0); } // everything else returns 0 return 0; } //------------------------------------------------- // iochip_0_w - handle writes to the first I/O // chip //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::iochip_0_w ) { // access is via the low 8 bits if (!ACCESSING_BITS_0_7) return; data &= 0xff; // swap in the new value and remember the previous value UINT8 oldval = m_iochip_regs[0][offset]; m_iochip_regs[0][offset] = data; // certain offsets have common effects switch (offset) { case 2: // Output port: // D7: (Not connected) // D6: (/WDC) - watchdog reset // D5: Screen display (1= blanked, 0= displayed) // D4-D2: (ADC2-0) // D1: (CONT) - affects sprite hardware // D0: Sound section reset (1= normal operation, 0= reset) if (((oldval ^ data) & 0x40) && !(data & 0x40)) m_watchdog->watchdog_reset(); m_segaic16vid->set_display_enable(data & 0x20); m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); if (m_soundcpu2 != nullptr) m_soundcpu2->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); break; case 3: // Output port: // D7: Amplifier mute control (1= sounding, 0= muted) // D6-D0: CN D pin A17-A23 (output level 1= high, 0= low) - usually set up as lamps and coincounter machine().sound().system_enable(data & 0x80); break; default: break; } // if there's custom I/O, handle that as well if (!m_iochip_custom_io_w[0][offset].isnull()) m_iochip_custom_io_w[0][offset](data); else if (offset <= 4) logerror("I/O chip 0, port %c write = %02X\n", 'A' + offset, data); } //------------------------------------------------- // iochip_1_r - handle reads from the second I/O // chip //------------------------------------------------- READ16_MEMBER( segaxbd_state::iochip_1_r ) { switch (offset) { case 0: // Input port: switches, CN D pin A1-8 (switch state 1= open, 0= closed) return iochip_r(1, 0, ioport("IO1PORTA")->read()); case 1: // Input port: switches, CN D pin A9-16 (switch state 1= open, 0= closed) return iochip_r(1, 1, ioport("IO1PORTB")->read()); case 2: // Input port: DIP switches (1= off, 0= on) return iochip_r(1, 2, ioport("IO1PORTC")->read()); case 3: // Input port: DIP switches (1= off, 0= on) return iochip_r(1, 3, ioport("IO1PORTD")->read()); case 4: // Unused return iochip_r(1, 4, 0); } // everything else returns 0 return 0; } //------------------------------------------------- // iochip_1_w - handle writes to the second I/O // chip //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::iochip_1_w ) { // access is via the low 8 bits if (!ACCESSING_BITS_0_7) return; data &= 0xff; m_iochip_regs[1][offset] = data; // if there's custom I/O, handle that as well if (!m_iochip_custom_io_w[1][offset].isnull()) m_iochip_custom_io_w[1][offset](data); else if (offset <= 4) logerror("I/O chip 1, port %c write = %02X\n", 'A' + offset, data); }<|fim▁hole|>//------------------------------------------------- // iocontrol_w - handle writes to the I/O control // port //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::iocontrol_w ) { if (ACCESSING_BITS_0_7) { logerror("I/O chip force input = %d\n", data & 1); // Racing Hero and ABCop set this and fouls up their output ports //iochip_force_input = data & 1; } } //************************************************************************** // GAME-SPECIFIC MAIN CPU READ/WRITE HANDLERS //************************************************************************** //------------------------------------------------- // loffire_sync0_w - force synchronization on // writes to this address for Line of Fire //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::loffire_sync0_w ) { COMBINE_DATA(&m_loffire_sync[offset]); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10)); } //------------------------------------------------- // rascot_excs_r - /EXCS region reads for Rascot //------------------------------------------------- READ16_MEMBER( segaxbd_state::rascot_excs_r ) { //logerror("%06X:rascot_excs_r(%04X)\n", m_maincpu->pc(), offset*2); // probably receives commands from the server here //return space.machine().rand() & 0xff; return 0xff; } //------------------------------------------------- // rascot_excs_w - /EXCS region writes for Rascot //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::rascot_excs_w ) { //logerror("%06X:rascot_excs_w(%04X) = %04X & %04X\n", m_maincpu->pc(), offset*2, data, mem_mask); } //------------------------------------------------- // smgp_excs_r - /EXCS region reads for // Super Monaco GP //------------------------------------------------- READ16_MEMBER( segaxbd_state::smgp_excs_r ) { //logerror("%06X:smgp_excs_r(%04X)\n", m_maincpu->pc(), offset*2); return 0xffff; } //------------------------------------------------- // smgp_excs_w - /EXCS region writes for // Super Monaco GP //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::smgp_excs_w ) { //logerror("%06X:smgp_excs_w(%04X) = %04X & %04X\n", m_maincpu->pc(), offset*2, data, mem_mask); } //************************************************************************** // SOUND Z80 CPU READ/WRITE CALLBACKS //************************************************************************** //------------------------------------------------- // sound_data_r - read latched sound data //------------------------------------------------- READ8_MEMBER( segaxbd_state::sound_data_r ) { m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); return m_soundlatch->read(space, 0); } //************************************************************************** // DRIVER OVERRIDES //************************************************************************** //------------------------------------------------- // device_timer - handle device timers //------------------------------------------------- void segaxbd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TID_SOUND_WRITE: m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, param); m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); // if an extra sound board is attached, do an nmi there as well if (m_soundcpu2 != nullptr) m_soundcpu2->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); break; case TID_SCANLINE: { int scanline = param; int next_scanline = (scanline + 2) % 262; bool update = false; // clock the timer and set the IRQ if something happened if ((scanline % 2) != 0 && m_cmptimer_1->clock()) m_timer_irq_state = 1, update = true; // set VBLANK on scanline 223 if (scanline == 223) { m_vblank_irq_state = 1; update = true; m_subcpu->set_input_line(4, ASSERT_LINE); next_scanline = scanline + 1; } // clear VBLANK on scanline 224 else if (scanline == 224) { m_vblank_irq_state = 0; update = true; m_subcpu->set_input_line(4, CLEAR_LINE); next_scanline = scanline + 1; } // update IRQs on the main CPU if (update) update_main_irqs(); // come back in 2 scanlines m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline); break; } } } //************************************************************************** // CUSTOM I/O HANDLERS //************************************************************************** //------------------------------------------------- // generic_iochip0_lamps_w - shared handler for // coin counters and lamps //------------------------------------------------- void segaxbd_state::generic_iochip0_lamps_w(UINT8 data) { // d0: ? // d3: always 0? // d4: coin counter // d7: mute audio (always handled above) // other bits: lamps machine().bookkeeping().coin_counter_w(0, (data >> 4) & 0x01); // // aburner2: // d1: altitude warning lamp // d2: start lamp // d5: lock on lamp // d6: danger lamp // in clone aburner, lamps work only in testmode? machine().output().set_lamp_value(0, (data >> 5) & 0x01); machine().output().set_lamp_value(1, (data >> 6) & 0x01); machine().output().set_lamp_value(2, (data >> 1) & 0x01); machine().output().set_lamp_value(3, (data >> 2) & 0x01); } //------------------------------------------------- // aburner2_iochip0_motor_r - motor I/O reads // for Afterburner II //------------------------------------------------- UINT8 segaxbd_state::aburner2_iochip0_motor_r(UINT8 data) { data &= 0xc0; // TODO return data | 0x3f; } //------------------------------------------------- // aburner2_iochip0_motor_w - motor I/O writes // for Afterburner II //------------------------------------------------- void segaxbd_state::aburner2_iochip0_motor_w(UINT8 data) { // TODO } //------------------------------------------------- // smgp_iochip0_motor_r - motor I/O reads // for Super Monaco GP //------------------------------------------------- UINT8 segaxbd_state::smgp_iochip0_motor_r(UINT8 data) { data &= 0xc0; // TODO return data | 0x0; } //------------------------------------------------- // smgp_iochip0_motor_w - motor I/O reads // for Super Monaco GP //------------------------------------------------- void segaxbd_state::smgp_iochip0_motor_w(UINT8 data) { // TODO } //------------------------------------------------- // lastsurv_iochip1_port_r - muxed I/O reads // for Last Survivor //------------------------------------------------- UINT8 segaxbd_state::lastsurv_iochip1_port_r(UINT8 data) { return m_mux_ports[m_lastsurv_mux].read_safe(0xff); } //------------------------------------------------- // lastsurv_iochip0_muxer_w - muxed I/O writes // for Last Survivor //------------------------------------------------- void segaxbd_state::lastsurv_iochip0_muxer_w(UINT8 data) { m_lastsurv_mux = (data >> 5) & 3; generic_iochip0_lamps_w(data & 0x9f); } //************************************************************************** // INTERNAL HELPERS //************************************************************************** //------------------------------------------------- // update_main_irqs - flush IRQ state to the // CPU device //------------------------------------------------- void segaxbd_state::update_main_irqs() { UINT8 irq = 0; if (m_timer_irq_state) irq |= 2; else m_maincpu->set_input_line(2, CLEAR_LINE); if (m_vblank_irq_state) irq |= 4; else m_maincpu->set_input_line(4, CLEAR_LINE); if (m_gprider_hack && irq > 4) irq = 4; if (irq != 6) m_maincpu->set_input_line(6, CLEAR_LINE); if (irq) { m_maincpu->set_input_line(irq, ASSERT_LINE); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100)); } } //------------------------------------------------- // m68k_reset_callback - callback for when the // main 68000 is reset //------------------------------------------------- WRITE_LINE_MEMBER(segaxbd_state::m68k_reset_callback) { m_subcpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100)); } //------------------------------------------------- // palette_init - precompute weighted RGB values // for each input value 0-31 //------------------------------------------------- void segaxbd_state::palette_init() { // // Color generation details // // Each color is made up of 5 bits, connected through one or more resistors like so: // // Bit 0 = 1 x 3.9K ohm // Bit 1 = 1 x 2.0K ohm // Bit 2 = 1 x 1.0K ohm // Bit 3 = 2 x 1.0K ohm // Bit 4 = 4 x 1.0K ohm // // Another data bit is connected by a tristate buffer to the color output through a // 470 ohm resistor. The buffer allows the resistor to have no effect (tristate), // halve brightness (pull-down) or double brightness (pull-up). The data bit source // is bit 15 of each color RAM entry. // // compute weight table for regular palette entries static const int resistances_normal[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 0 }; double weights_normal[6]; compute_resistor_weights(0, 255, -1.0, 6, resistances_normal, weights_normal, 0, 0, 0, nullptr, nullptr, 0, 0, 0, nullptr, nullptr, 0, 0); // compute weight table for shadow/hilight palette entries static const int resistances_sh[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 470 }; double weights_sh[6]; compute_resistor_weights(0, 255, -1.0, 6, resistances_sh, weights_sh, 0, 0, 0, nullptr, nullptr, 0, 0, 0, nullptr, nullptr, 0, 0); // compute R, G, B for each weight for (int value = 0; value < 32; value++) { int i4 = (value >> 4) & 1; int i3 = (value >> 3) & 1; int i2 = (value >> 2) & 1; int i1 = (value >> 1) & 1; int i0 = (value >> 0) & 1; m_palette_normal[value] = combine_6_weights(weights_normal, i0, i1, i2, i3, i4, 0); m_palette_shadow[value] = combine_6_weights(weights_sh, i0, i1, i2, i3, i4, 0); m_palette_hilight[value] = combine_6_weights(weights_sh, i0, i1, i2, i3, i4, 1); } } //------------------------------------------------- // paletteram_w - handle writes to palette RAM //------------------------------------------------- WRITE16_MEMBER( segaxbd_state::paletteram_w ) { // compute the number of entries if (m_palette_entries == 0) m_palette_entries = memshare("paletteram")->bytes() / 2; // get the new value UINT16 newval = m_paletteram[offset]; COMBINE_DATA(&newval); m_paletteram[offset] = newval; // byte 0 byte 1 // sBGR BBBB GGGG RRRR // x000 4321 4321 4321 int r = ((newval >> 12) & 0x01) | ((newval << 1) & 0x1e); int g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e); int b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e); // normal colors m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal[b]); m_palette->set_pen_color(offset + 1 * m_palette_entries, m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]); m_palette->set_pen_color(offset + 2 * m_palette_entries, m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]); } //************************************************************************** // MAIN CPU ADDRESS MAPS //************************************************************************** static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0x3fffff) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x083fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("backup1") AM_RANGE(0x0a0000, 0x0a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("backup2") AM_RANGE(0x0c0000, 0x0cffff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") AM_RANGE(0x0e0000, 0x0e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_main", sega_315_5248_multiplier_device, read, write) AM_RANGE(0x0e4000, 0x0e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_main", sega_315_5249_divider_device, read, write) AM_RANGE(0x0e8000, 0x0e801f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("cmptimer_main", sega_315_5250_compare_timer_device, read, write) AM_RANGE(0x100000, 0x100fff) AM_MIRROR(0x00f000) AM_RAM AM_SHARE("sprites") AM_RANGE(0x110000, 0x11ffff) AM_DEVWRITE("sprites", sega_xboard_sprite_device, draw_write) AM_RANGE(0x120000, 0x123fff) AM_MIRROR(0x00c000) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x130000, 0x13ffff) AM_READWRITE(adc_r, adc_w) AM_RANGE(0x140000, 0x14000f) AM_MIRROR(0x00fff0) AM_READWRITE(iochip_0_r, iochip_0_w) AM_RANGE(0x150000, 0x15000f) AM_MIRROR(0x00fff0) AM_READWRITE(iochip_1_r, iochip_1_w) AM_RANGE(0x160000, 0x16ffff) AM_WRITE(iocontrol_w) AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("subcpu", 0x00000) AM_RANGE(0x280000, 0x283fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram0") AM_RANGE(0x2a0000, 0x2a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram1") AM_RANGE(0x2e0000, 0x2e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_subx", sega_315_5248_multiplier_device, read, write) AM_RANGE(0x2e4000, 0x2e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_subx", sega_315_5249_divider_device, read, write) AM_RANGE(0x2e8000, 0x2e800f) AM_MIRROR(0x003ff0) AM_DEVREADWRITE("cmptimer_subx", sega_315_5250_compare_timer_device, read, write) AM_RANGE(0x2ec000, 0x2ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("roadram") AM_RANGE(0x2ee000, 0x2effff) AM_DEVREADWRITE("segaic16road", segaic16_road_device, segaic16_road_control_0_r, segaic16_road_control_0_w) // AM_RANGE(0x2f0000, 0x2f3fff) AM_READWRITE(excs_r, excs_w) AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_SHARE("backup1") AM_RANGE(0x3fc000, 0x3fffff) AM_RAM AM_SHARE("backup2") ADDRESS_MAP_END static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, segaxbd_state ) AM_RANGE(0x00000, 0xfffff) AM_ROMBANK("fd1094_decrypted_opcodes") ADDRESS_MAP_END //************************************************************************** // SUB CPU ADDRESS MAPS //************************************************************************** static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 16, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xfffff) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x083fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram0") AM_RANGE(0x0a0000, 0x0a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram1") AM_RANGE(0x0e0000, 0x0e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_subx", sega_315_5248_multiplier_device, read, write) AM_RANGE(0x0e4000, 0x0e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_subx", sega_315_5249_divider_device, read, write) AM_RANGE(0x0e8000, 0x0e800f) AM_MIRROR(0x003ff0) AM_DEVREADWRITE("cmptimer_subx", sega_315_5250_compare_timer_device, read, write) AM_RANGE(0x0ec000, 0x0ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("roadram") AM_RANGE(0x0ee000, 0x0effff) AM_DEVREADWRITE("segaic16road", segaic16_road_device, segaic16_road_control_0_r, segaic16_road_control_0_w) // AM_RANGE(0x0f0000, 0x0f3fff) AM_READWRITE(excs_r, excs_w) ADDRESS_MAP_END //************************************************************************** // Z80 SOUND CPU ADDRESS MAPS //************************************************************************** static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE("pcm", segapcm_device, sega_pcm_r, sega_pcm_w) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r) ADDRESS_MAP_END //************************************************************************** // SUPER MONACO GP 2ND SOUND CPU ADDRESS MAPS //************************************************************************** // Sound Board // The extra sound is used when the cabinet is Deluxe(Air Drive), or Cockpit. The soundlatch is // shared with the main board sound. static ADDRESS_MAP_START( smgp_sound2_map, AS_PROGRAM, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE("pcm2", segapcm_device, sega_pcm_r, sega_pcm_w) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( smgp_sound2_portmap, AS_IO, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r) ADDRESS_MAP_END //************************************************************************** // SUPER MONACO GP MOTOR BOARD CPU ADDRESS MAPS //************************************************************************** // Motor Board, not yet emulated static ADDRESS_MAP_START( smgp_airdrive_map, AS_PROGRAM, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xafff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( smgp_airdrive_portmap, AS_IO, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x01, 0x01) AM_READNOP AM_RANGE(0x02, 0x03) AM_NOP ADDRESS_MAP_END //************************************************************************** // SUPER MONACO GP LINK BOARD CPU ADDRESS MAPS //************************************************************************** // Link Board, not yet emulated static ADDRESS_MAP_START( smgp_comm_map, AS_PROGRAM, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x3fff) AM_RAM AM_RANGE(0x4000, 0x47ff) AM_RAM // MB8421 Dual-Port SRAM ADDRESS_MAP_END static ADDRESS_MAP_START( smgp_comm_portmap, AS_IO, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END //************************************************************************** // RASCOT UNKNOWN Z80 CPU ADDRESS MAPS //************************************************************************** // Z80, unknown function static ADDRESS_MAP_START( rascot_z80_map, AS_PROGRAM, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xafff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( rascot_z80_portmap, AS_IO, 8, segaxbd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END //************************************************************************** // GENERIC PORT DEFINITIONS //************************************************************************** static INPUT_PORTS_START( xboard_generic ) PORT_START("mainpcb:IO0PORTA") PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // /INTR of ADC0804 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("mainpcb:IO0PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("mainpcb:IO1PORTA") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button? not used by any game we have PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // cannon trigger or shift down PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // missile button or shift up PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_START("mainpcb:IO1PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("mainpcb:IO1PORTC") SEGA_COINAGE_LOC(SWA) PORT_START("mainpcb:IO1PORTD") PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SWB:1" ) PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SWB:2" ) PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SWB:3" ) PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SWB:4" ) PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SWB:5" ) PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWB:6" ) PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SWB:7" ) PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SWB:8" ) INPUT_PORTS_END //************************************************************************** // GAME-SPECIFIC PORT DEFINITIONS //************************************************************************** static INPUT_PORTS_START( aburner ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Vulcan") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Missile") PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x03, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1,2") PORT_DIPSETTING( 0x03, "Moving Deluxe" ) PORT_DIPSETTING( 0x02, "Moving Standard" ) PORT_DIPSETTING( 0x01, DEF_STR( Upright ) ) // PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // According to the manual, SWB:4 sets 3 or 4 lives, but it doesn't actually do that. // However, it does on Afterburner II. Maybe there's another version of Afterburner // that behaves as the manual suggests. // In the Japanese manual "DIP SW B:4 / NOT USED" PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:5") PORT_DIPSETTING( 0x10, "3" ) PORT_DIPSETTING( 0x00, "3x Credits" ) PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_START("mainpcb:ADC0") // stick X PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_START("mainpcb:ADC1") // stick Y PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x40,0xc0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE PORT_START("mainpcb:ADC2") // throttle PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(100) PORT_KEYDELTA(79) PORT_START("mainpcb:ADC3") // motor Y PORT_BIT( 0xff, (0xb0+0x50)/2, IPT_SPECIAL ) PORT_START("mainpcb:ADC4") // motor X PORT_BIT( 0xff, (0xb0+0x50)/2, IPT_SPECIAL ) INPUT_PORTS_END static INPUT_PORTS_START( aburner2 ) PORT_INCLUDE( aburner ) PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x03, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1,2") PORT_DIPSETTING( 0x03, "Moving Deluxe" ) PORT_DIPSETTING( 0x02, "Moving Standard" ) PORT_DIPSETTING( 0x01, "Upright 1" ) PORT_DIPSETTING( 0x00, "Upright 2" ) PORT_DIPNAME( 0x04, 0x04, "Throttle Lever" ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5") PORT_DIPSETTING( 0x18, "3" ) PORT_DIPSETTING( 0x10, "4" ) PORT_DIPSETTING( 0x08, "3x Credits" ) PORT_DIPSETTING( 0x00, "4x Credits" ) PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END static INPUT_PORTS_START( thndrbld ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Cannon") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Missile") PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x01, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1") PORT_DIPSETTING( 0x01, "Econ Upright" ) PORT_DIPSETTING( 0x00, "Mini Upright" ) // see note about inputs below PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, "Time" ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x04, "30 sec" ) PORT_DIPSETTING( 0x00, "0 sec" ) PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5") PORT_DIPSETTING( 0x08, "2" ) PORT_DIPSETTING( 0x18, "3" ) PORT_DIPSETTING( 0x10, "4" ) PORT_DIPSETTING( 0x00, "5" ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x80, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) // These inputs are valid for the "Econ Upright" and "Deluxe" cabinets. // On the "Standing" cabinet, the joystick Y axis is reversed. // On the "Mini Upright" cabinet, the inputs conform to After Burner II: // the X axis is (un-)reversed, and the throttle and Y axis switch places PORT_START("mainpcb:ADC0") // stick X PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE PORT_START("mainpcb:ADC1") // "slottle" PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(100) PORT_KEYDELTA(79) PORT_START("mainpcb:ADC2") // stick Y PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) INPUT_PORTS_END static INPUT_PORTS_START( thndrbd1 ) PORT_INCLUDE( thndrbld ) PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x01, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1") PORT_DIPSETTING( 0x01, "Deluxe" ) PORT_DIPSETTING( 0x00, "Standing" ) // see note about inputs above PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, "Time" ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x04, "30 sec" ) PORT_DIPSETTING( 0x00, "0 sec" ) PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5") PORT_DIPSETTING( 0x08, "2" ) PORT_DIPSETTING( 0x18, "3" ) PORT_DIPSETTING( 0x10, "4" ) PORT_DIPSETTING( 0x00, "5" ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x80, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END static const ioport_value lastsurv_position_table[] = { 0x0f ^ 0x08 ^ 0x01, // down + left 0x0f ^ 0x01, // left 0x0f ^ 0x04 ^ 0x01, // up + left 0x0f ^ 0x04, // up 0x0f ^ 0x04 ^ 0x02, // up + right 0x0f ^ 0x02, // right 0x0f ^ 0x08 ^ 0x02, // down + right 0x0f ^ 0x08, // down }; static INPUT_PORTS_START( lastsurv ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_START("mainpcb:MUX0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0xf0, 0xf0 ^ 0x40, IPT_POSITIONAL ) PORT_PLAYER(2) PORT_POSITIONS(8) PORT_REMAP_TABLE(lastsurv_position_table) PORT_WRAPS PORT_SENSITIVITY(1) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_START("mainpcb:MUX1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0xf0, 0xf0 ^ 0x40, IPT_POSITIONAL ) PORT_PLAYER(1) PORT_POSITIONS(8) PORT_REMAP_TABLE(lastsurv_position_table) PORT_WRAPS PORT_SENSITIVITY(1) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_START("mainpcb:MUX2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("mainpcb:MUX3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x03, 0x03, "I.D. No" ) PORT_DIPLOCATION("SWB:1,2") PORT_DIPSETTING( 0x03, "1" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "4" ) PORT_DIPNAME( 0x0c, 0x0c, "Network" ) PORT_DIPLOCATION("SWB:3,4") PORT_DIPSETTING( 0x0c, "Off" ) PORT_DIPSETTING( 0x08, "On (2)" ) PORT_DIPSETTING( 0x04, "On (4)" ) // PORT_DIPSETTING( 0x00, "No Use" ) PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:5,6") PORT_DIPSETTING( 0x20, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x30, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, "Coin Chute" ) PORT_DIPLOCATION("SWB:8") PORT_DIPSETTING( 0x80, "Single" ) PORT_DIPSETTING( 0x00, "Twin" ) INPUT_PORTS_END static INPUT_PORTS_START( loffire ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_MODIFY("mainpcb:IO1PORTB") PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x01, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SWB:1") PORT_DIPSETTING( 0x01, DEF_STR( Japanese ) ) PORT_DIPSETTING( 0x00, DEF_STR( English ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:2") PORT_DIPSETTING( 0x02, "Cockpit" ) PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPNAME( 0x04, 0x04, "2 Credits to Start" ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:4,5") PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x18, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, "Coin Chute" ) PORT_DIPLOCATION("SWB:8") PORT_DIPSETTING( 0x80, DEF_STR( Single ) ) PORT_DIPSETTING( 0x00, "Twin" ) PORT_START("mainpcb:ADC0") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_START("mainpcb:ADC1") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_START("mainpcb:ADC2") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_START("mainpcb:ADC3") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(2) INPUT_PORTS_END static INPUT_PORTS_START( rachero ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Move to Center") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Suicide") PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x01, 0x01, "Credits" ) PORT_DIPLOCATION("SWB:1") PORT_DIPSETTING( 0x01, "1 to Start, 1 to Continue" ) PORT_DIPSETTING( 0x00, "2 to Start, 1 to Continue" ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x04, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_DIPNAME( 0x30, 0x30, "Time" ) PORT_DIPLOCATION("SWB:5,6") PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x30, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x80, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) PORT_START("mainpcb:ADC0") // steering PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE PORT_START("mainpcb:ADC1") // gas pedal PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_START("mainpcb:ADC2") // brake PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) INPUT_PORTS_END static INPUT_PORTS_START( smgp ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Shift Down") PORT_CODE(KEYCODE_A) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Shift Up") PORT_CODE(KEYCODE_Z) PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x07, 0x07, "Machine ID" ) PORT_DIPLOCATION("SWB:1,2,3") PORT_DIPSETTING( 0x07, "1" ) PORT_DIPSETTING( 0x06, "2" ) PORT_DIPSETTING( 0x05, "3" ) PORT_DIPSETTING( 0x04, "4" ) PORT_DIPSETTING( 0x03, "5" ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x01, "7" ) PORT_DIPSETTING( 0x00, "8" ) PORT_DIPNAME( 0x38, 0x38, "Number of Machines" ) PORT_DIPLOCATION("SWB:4,5,6") PORT_DIPSETTING( 0x38, "1" ) PORT_DIPSETTING( 0x30, "2" ) PORT_DIPSETTING( 0x28, "3" ) PORT_DIPSETTING( 0x20, "4" ) PORT_DIPSETTING( 0x18, "5" ) PORT_DIPSETTING( 0x10, "6" ) PORT_DIPSETTING( 0x08, "7" ) PORT_DIPSETTING( 0x00, "8" ) PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0xc0, "Deluxe" ) PORT_DIPSETTING( 0x80, "Cockpit" ) PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) // PORT_DIPSETTING( 0x00, "Deluxe" ) PORT_START("mainpcb:ADC0") // steering PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x38,0xc8) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_START("mainpcb:ADC1") // gas pedal PORT_BIT( 0xff, 0x38, IPT_PEDAL ) PORT_MINMAX(0x38,0xb8) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_START("mainpcb:ADC2") // brake PORT_BIT( 0xff, 0x28, IPT_PEDAL2 ) PORT_MINMAX(0x28,0xa8) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) INPUT_PORTS_END static INPUT_PORTS_START( abcop ) PORT_INCLUDE( xboard_generic ) PORT_MODIFY("mainpcb:IO1PORTA") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Jump") PORT_MODIFY("mainpcb:IO1PORTD") PORT_DIPNAME( 0x01, 0x01, "Credits" ) PORT_DIPLOCATION("SWB:1") PORT_DIPSETTING( 0x01, "1 to Start, 1 to Continue" ) PORT_DIPSETTING( 0x00, "2 to Start, 1 to Continue" ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:3") PORT_DIPSETTING( 0x04, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_DIPNAME( 0x30, 0x30, "Time" ) PORT_DIPLOCATION("SWB:5,6") PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x30, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x80, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_START("mainpcb:ADC0") // steering PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE PORT_START("mainpcb:ADC1") // accelerator PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) INPUT_PORTS_END static INPUT_PORTS_START( gprider ) PORT_START("mainpcb:IO0PORTA") PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // /INTR of ADC0804 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("mainpcb:IO0PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("mainpcb:IO1PORTA") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button? not used by any game we have PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Shift Down") PORT_CODE(KEYCODE_A) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Shift Up") PORT_CODE(KEYCODE_Z) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_START("mainpcb:IO1PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("mainpcb:IO1PORTC") SEGA_COINAGE_LOC(SWA) PORT_START("mainpcb:IO1PORTD") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1,2") PORT_DIPSETTING( 0x03, "Ride On" ) PORT_DIPSETTING( 0x02, DEF_STR( Upright ) ) // PORT_DIPSETTING( 0x01, DEF_STR( Unused ) ) // PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SWB:3" ) PORT_DIPNAME( 0x08, 0x08, "ID No." ) PORT_DIPLOCATION("SWB:4") PORT_DIPSETTING( 0x08, "Main" ) // Player 1 (Blue) PORT_DIPSETTING( 0x00, "Slave" ) // Player 2 (Red) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWB:6" ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_START("mainpcb:ADC0") // steering PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_START("mainpcb:ADC1") // gas pedal PORT_BIT( 0xff, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_START("mainpcb:ADC2") // brake PORT_BIT( 0xff, 0x10, IPT_PEDAL2 ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) PORT_REVERSE INPUT_PORTS_END static INPUT_PORTS_START( gprider_double ) PORT_INCLUDE( gprider ) PORT_START("subpcb:IO0PORTA") PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // /INTR of ADC0804 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("subpcb:IO0PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("subpcb:IO1PORTA") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button? not used by any game we have PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Shift Down") PORT_CODE(KEYCODE_W) PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Shift Up") PORT_CODE(KEYCODE_S) PORT_PLAYER(2) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 ) PORT_START("subpcb:IO1PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("subpcb:IO1PORTC") SEGA_COINAGE_LOC(SWA) PORT_START("subpcb:IO1PORTD") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1,2") PORT_DIPSETTING( 0x03, "Ride On" ) PORT_DIPSETTING( 0x02, DEF_STR( Upright ) ) // PORT_DIPSETTING( 0x01, DEF_STR( Unused ) ) // PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SWB:3" ) PORT_DIPNAME( 0x08, 0x00, "ID No." ) PORT_DIPLOCATION("SWB:4") PORT_DIPSETTING( 0x08, "Main" ) // Player 1 (Blue) PORT_DIPSETTING( 0x00, "Slave" ) // Player 2 (Red) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWB:6" ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_START("subpcb:ADC0") // steering PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(2) PORT_START("subpcb:ADC1") // gas pedal PORT_BIT( 0xff, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2) PORT_START("subpcb:ADC2") // brake PORT_BIT( 0xff, 0x10, IPT_PEDAL2 ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) PORT_REVERSE PORT_PLAYER(2) INPUT_PORTS_END static INPUT_PORTS_START( rascot ) PORT_INCLUDE( xboard_generic ) INPUT_PORTS_END //************************************************************************** // GRAPHICS DEFINITIONS //************************************************************************** static GFXDECODE_START( segaxbd ) GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x3_planar, 0, 1024 ) GFXDECODE_END //************************************************************************** // GENERIC MACHINE DRIVERS //************************************************************************** static MACHINE_CONFIG_FRAGMENT( xboard ) // basic machine hardware MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK/4) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_CPU_ADD("subcpu", M68000, MASTER_CLOCK/4) MCFG_CPU_PROGRAM_MAP(sub_map) MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK/4) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_CPU_IO_MAP(sound_portmap) MCFG_NVRAM_ADD_0FILL("backup1") MCFG_NVRAM_ADD_0FILL("backup2") MCFG_QUANTUM_TIME(attotime::from_hz(6000)) MCFG_WATCHDOG_ADD("watchdog") MCFG_SEGA_315_5248_MULTIPLIER_ADD("multiplier_main") MCFG_SEGA_315_5248_MULTIPLIER_ADD("multiplier_subx") MCFG_SEGA_315_5249_DIVIDER_ADD("divider_main") MCFG_SEGA_315_5249_DIVIDER_ADD("divider_subx") MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_main") MCFG_SEGA_315_5250_TIMER_ACK(segaxbd_state, timer_ack_callback) MCFG_SEGA_315_5250_SOUND_WRITE(segaxbd_state, sound_data_w) MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_subx") // video hardware MCFG_GFXDECODE_ADD("gfxdecode", "palette", segaxbd) MCFG_PALETTE_ADD("palette", 8192*3) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/8, 400, 0, 320, 262, 0, 224) MCFG_SCREEN_UPDATE_DRIVER(segaxbd_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_SEGA_XBOARD_SPRITES_ADD("sprites") MCFG_SEGAIC16VID_ADD("segaic16vid") MCFG_SEGAIC16VID_GFXDECODE("gfxdecode") MCFG_VIDEO_SET_SCREEN("screen") MCFG_SEGAIC16_ROAD_ADD("segaic16road") // sound hardware MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_GENERIC_LATCH_8_ADD("soundlatch") MCFG_YM2151_ADD("ymsnd", SOUND_CLOCK/4) MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0)) MCFG_SOUND_ROUTE(0, "lspeaker", 0.43) MCFG_SOUND_ROUTE(1, "rspeaker", 0.43) MCFG_SEGAPCM_ADD("pcm", SOUND_CLOCK/4) MCFG_SEGAPCM_BANK(BANK_512) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END const device_type SEGA_XBD_REGULAR_DEVICE = &device_creator<segaxbd_regular_state>; segaxbd_regular_state::segaxbd_regular_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_regular_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( xboard ); } static MACHINE_CONFIG_START( sega_xboard, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_REGULAR_DEVICE, 0) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( xboard_fd1094 ) MCFG_FRAGMENT_ADD( xboard ) MCFG_CPU_REPLACE("maincpu", FD1094, MASTER_CLOCK/4) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MACHINE_CONFIG_END const device_type SEGA_XBD_FD1094_DEVICE = &device_creator<segaxbd_fd1094_state>; segaxbd_fd1094_state::segaxbd_fd1094_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_fd1094_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( xboard_fd1094 ); } static MACHINE_CONFIG_START( sega_xboard_fd1094, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_FD1094_DEVICE, 0) MACHINE_CONFIG_END static MACHINE_CONFIG_START( sega_xboard_fd1094_double, segaxbd_new_state_double ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_FD1094_DEVICE, 0) MCFG_DEVICE_ADD("subpcb", SEGA_XBD_FD1094_DEVICE, 0) //MCFG_QUANTUM_PERFECT_CPU("mainpcb:maincpu") // doesn't help.. MACHINE_CONFIG_END //************************************************************************** // GAME-SPECIFIC MACHINE DRIVERS //************************************************************************** static MACHINE_CONFIG_FRAGMENT( lastsurv_fd1094 ) MCFG_FRAGMENT_ADD( xboard_fd1094 ) // basic machine hardware // TODO: network board // sound hardware - ym2151 stereo is reversed MCFG_SOUND_MODIFY("ymsnd") MCFG_SOUND_ROUTES_RESET() MCFG_SOUND_ROUTE(0, "rspeaker", 0.43) MCFG_SOUND_ROUTE(1, "lspeaker", 0.43) MACHINE_CONFIG_END const device_type SEGA_XBD_LASTSURV_FD1094_DEVICE = &device_creator<segaxbd_lastsurv_fd1094_state>; segaxbd_lastsurv_fd1094_state::segaxbd_lastsurv_fd1094_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_lastsurv_fd1094_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( lastsurv_fd1094 ); } static MACHINE_CONFIG_START( sega_lastsurv_fd1094, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_LASTSURV_FD1094_DEVICE, 0) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( lastsurv ) MCFG_FRAGMENT_ADD( xboard ) // basic machine hardware // TODO: network board // sound hardware - ym2151 stereo is reversed MCFG_SOUND_MODIFY("ymsnd") MCFG_SOUND_ROUTES_RESET() MCFG_SOUND_ROUTE(0, "rspeaker", 0.43) MCFG_SOUND_ROUTE(1, "lspeaker", 0.43) MACHINE_CONFIG_END const device_type SEGA_XBD_LASTSURV_DEVICE = &device_creator<segaxbd_lastsurv_state>; segaxbd_lastsurv_state::segaxbd_lastsurv_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_lastsurv_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( lastsurv ); } static MACHINE_CONFIG_START( sega_lastsurv, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_LASTSURV_DEVICE, 0) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( smgp_fd1094 ) MCFG_FRAGMENT_ADD( xboard_fd1094 ) // basic machine hardware MCFG_CPU_ADD("soundcpu2", Z80, SOUND_CLOCK/4) MCFG_CPU_PROGRAM_MAP(smgp_sound2_map) MCFG_CPU_IO_MAP(smgp_sound2_portmap) MCFG_CPU_ADD("commcpu", Z80, XTAL_16MHz/2) // Z80E MCFG_CPU_PROGRAM_MAP(smgp_comm_map) MCFG_CPU_IO_MAP(smgp_comm_portmap) MCFG_CPU_ADD("motorcpu", Z80, XTAL_16MHz/2) // not verified MCFG_CPU_PROGRAM_MAP(smgp_airdrive_map) MCFG_CPU_IO_MAP(smgp_airdrive_portmap) // sound hardware MCFG_SPEAKER_STANDARD_STEREO("rearleft", "rearright") MCFG_SEGAPCM_ADD("pcm2", SOUND_CLOCK/4) MCFG_SEGAPCM_BANK(BANK_512) MCFG_SOUND_ROUTE(0, "rearleft", 1.0) MCFG_SOUND_ROUTE(1, "rearright", 1.0) MACHINE_CONFIG_END const device_type SEGA_XBD_SMGP_FD1094_DEVICE = &device_creator<segaxbd_smgp_fd1094_state>; segaxbd_smgp_fd1094_state::segaxbd_smgp_fd1094_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_smgp_fd1094_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( smgp_fd1094 ); } static MACHINE_CONFIG_START( sega_smgp_fd1094, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_SMGP_FD1094_DEVICE, 0) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( smgp ) MCFG_FRAGMENT_ADD( xboard ) // basic machine hardware MCFG_CPU_ADD("soundcpu2", Z80, SOUND_CLOCK/4) MCFG_CPU_PROGRAM_MAP(smgp_sound2_map) MCFG_CPU_IO_MAP(smgp_sound2_portmap) MCFG_CPU_ADD("commcpu", Z80, XTAL_16MHz/2) // Z80E MCFG_CPU_PROGRAM_MAP(smgp_comm_map) MCFG_CPU_IO_MAP(smgp_comm_portmap) MCFG_CPU_ADD("motorcpu", Z80, XTAL_16MHz/2) // not verified MCFG_CPU_PROGRAM_MAP(smgp_airdrive_map) MCFG_CPU_IO_MAP(smgp_airdrive_portmap) // sound hardware MCFG_SPEAKER_STANDARD_STEREO("rearleft", "rearright") MCFG_SEGAPCM_ADD("pcm2", SOUND_CLOCK/4) MCFG_SEGAPCM_BANK(BANK_512) MCFG_SOUND_ROUTE(0, "rearleft", 1.0) MCFG_SOUND_ROUTE(1, "rearright", 1.0) MACHINE_CONFIG_END const device_type SEGA_XBD_SMGP_DEVICE = &device_creator<segaxbd_smgp_state>; segaxbd_smgp_state::segaxbd_smgp_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_smgp_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( smgp ); } static MACHINE_CONFIG_START( sega_smgp, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_SMGP_DEVICE, 0) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( rascot ) MCFG_FRAGMENT_ADD( xboard ) // basic machine hardware MCFG_CPU_MODIFY("soundcpu") MCFG_CPU_PROGRAM_MAP(rascot_z80_map) MCFG_CPU_IO_MAP(rascot_z80_portmap) MACHINE_CONFIG_END const device_type SEGA_XBD_RASCOT_DEVICE = &device_creator<segaxbd_rascot_state>; segaxbd_rascot_state::segaxbd_rascot_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segaxbd_state(mconfig, tag, owner, clock) { } machine_config_constructor segaxbd_rascot_state::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( rascot ); } static MACHINE_CONFIG_START( sega_rascot, segaxbd_new_state ) MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_RASCOT_DEVICE, 0) MACHINE_CONFIG_END //************************************************************************** // ROM DEFINITIONS //************************************************************************** //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Afterburner, Sega X-board // CPU: 68000 (317-????) // // Missing the Deluxe/Upright English (US?) version rom set // Program roms: // EPR-11092.58 // EPR-11093.63 // EPR-10950.57 // EPR-10951.62 // Sub-Program // EPR-11090.30 // EPR-11091.20 // Fix Scroll Character // EPR-11089.154 // EPR-11088.153 // EPR-11087.152 // Object (Character & Scene Scenery) // EPR-11098.93 // EPR-11099.97 // EPR-11100.101 // EPR-11101.105 // EPR-11094.92-- // EPR-11095.96 \ These 4 found in Afterburner II (German)?? // EPR-11096.100 / // EPR-11097.104- // Sound Data // EPR-10929.13 // ROM_START( aburner ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-10940.58", 0x00000, 0x20000, CRC(4d132c4e) SHA1(007af52167c369177b86fc0f8b007ebceba2a30c) ) ROM_LOAD16_BYTE( "epr-10941.63", 0x00001, 0x20000, CRC(136ea264) SHA1(606ac67db53a6002ed1bd71287aed2e3e720cdf4) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-10927.20", 0x00000, 0x20000, CRC(66d36757) SHA1(c7f6d653fb6bfd629bb62057010d41f3ccfccc4d) ) ROM_LOAD16_BYTE( "epr-10928.29", 0x00001, 0x20000, CRC(7c01d40b) SHA1(d95b4702a9c813db8bc24c8cd7e0933cbe54a573) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-10926.154", 0x00000, 0x10000, CRC(ed8bd632) SHA1(d5bbd5e257ebef8cfb3baf5fa530b189d9cddb57) ) ROM_LOAD( "epr-10925.153", 0x10000, 0x10000, CRC(4ef048cc) SHA1(3b386b3bfa600f114dbc19796bb6864a88ff4562) ) ROM_LOAD( "epr-10924.152", 0x20000, 0x10000, CRC(50c15a6d) SHA1(fc202cc583fc6804647abc884fdf332e72ea3100) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-10932.90", 0x000000, 0x20000, CRC(cc0821d6) SHA1(22e84419a585209bbda1466d2180504c316a9b7f) ) // First 8 roms are MPR, the rest are EPR ROM_LOAD32_BYTE( "mpr-10934.94", 0x000001, 0x20000, CRC(4a51b1fa) SHA1(2eed018a5a1e935bb72b6f440a794466a1397dc5) ) ROM_LOAD32_BYTE( "mpr-10936.98", 0x000002, 0x20000, CRC(ada70d64) SHA1(ba6203b0fdb4c4998b7be5b446eb8354751d553a) ) ROM_LOAD32_BYTE( "mpr-10938.102", 0x000003, 0x20000, CRC(e7675baf) SHA1(aa979319a44c0b18c462afb5ca9cdeed2292c76a) ) ROM_LOAD32_BYTE( "mpr-10933.91", 0x080000, 0x20000, CRC(c8efb2c3) SHA1(ba31da93f929f2c457e60b2099d5a1ba6b5a9f48) ) ROM_LOAD32_BYTE( "mpr-10935.95", 0x080001, 0x20000, CRC(c1e23521) SHA1(5e95f3b6ff9f4caca676eaa6c84f1200315218ea) ) ROM_LOAD32_BYTE( "mpr-10937.99", 0x080002, 0x20000, CRC(f0199658) SHA1(cd67504fef53f637a3b1c723c4a04148f88028d2) ) ROM_LOAD32_BYTE( "mpr-10939.103", 0x080003, 0x20000, CRC(a0d49480) SHA1(6c4234456bc09ae771beec284d7aa21ebe474f6f) ) ROM_LOAD32_BYTE( "epr-10942.92", 0x100000, 0x20000, CRC(5ce10b8c) SHA1(c6c189143762b0ef473d5d31d66226820c5cf080) ) ROM_LOAD32_BYTE( "epr-10943.96", 0x100001, 0x20000, CRC(b98294dc) SHA1(a4161af23f9a67b4ed81308c73e72e1797cce894) ) ROM_LOAD32_BYTE( "epr-10944.100", 0x100002, 0x20000, CRC(17be8f67) SHA1(371f0dd1914a98695cb86f921fe8e82b49e69a4a) ) ROM_LOAD32_BYTE( "epr-10945.104", 0x100003, 0x20000, CRC(df4d4c4f) SHA1(24075a6709869d9acf9082b6b4ad96bc6f8b1932) ) ROM_LOAD32_BYTE( "epr-10946.93", 0x180000, 0x20000, CRC(d7d485f4) SHA1(d843aefb4d99e0dff8d62ee6bd0c3aa6aa6c941b) ) ROM_LOAD32_BYTE( "epr-10947.97", 0x180001, 0x20000, CRC(08838392) SHA1(84f7ff3bff31c0738dead7bc00219ede834eb0e0) ) ROM_LOAD32_BYTE( "epr-10948.101", 0x180002, 0x20000, CRC(64284761) SHA1(9594c671900f7f49d8fb965bc17b4380ce2c68d5) ) ROM_LOAD32_BYTE( "epr-10949.105", 0x180003, 0x20000, CRC(d8437d92) SHA1(480291358c3d197645d7bd149bdfe5d41071d52d) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx ROM_LOAD( "epr-10922.40", 0x000000, 0x10000, CRC(b49183d4) SHA1(71d87bfbce858049ccde9597ab15575b3cdba892) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-10923.17", 0x00000, 0x10000, CRC(6888eb8f) SHA1(8f8fffb214842a5d356e33f5a97099bc6407384f) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-10931.11", 0x00000, 0x20000, CRC(9209068f) SHA1(01f3dda1c066d00080c55f2c86c506b6b2407f98) ) ROM_LOAD( "mpr-10930.12", 0x20000, 0x20000, CRC(6493368b) SHA1(328aff19ff1d1344e9115f519d3962390c4e5ba4) ) ROM_LOAD( "epr-10929.13", 0x40000, 0x20000, CRC(6c07c78d) SHA1(3868b1824f43e4f2b4fbcd9274bfb3000c889d12) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Afterburner II, Sega X-board // CPU: 68000 (317-????) // ROM_START( aburner2 ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-11107.58", 0x00000, 0x20000, CRC(6d87bab7) SHA1(ab34fe78f1f216037b3e3dca3e61f1b31c05cedf) ) ROM_LOAD16_BYTE( "epr-11108.63", 0x00001, 0x20000, CRC(202a3e1d) SHA1(cf2018bbad366de4b222eae35942636ca68aa581) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-11109.20", 0x00000, 0x20000, CRC(85a0fe07) SHA1(5a3a8fda6cb4898cfece4ec865b81b9b60f9ad55) ) ROM_LOAD16_BYTE( "epr-11110.29", 0x00001, 0x20000, CRC(f3d6797c) SHA1(17487b89ddbfbcc32a0b52268259f1c8d10fd0b2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-11115.154", 0x00000, 0x10000, CRC(e8e32921) SHA1(30a96e6b514a475c778296228ba5b6fb96b211b0) ) ROM_LOAD( "epr-11114.153", 0x10000, 0x10000, CRC(2e97f633) SHA1(074125c106dd00785903b2e10cd7e28d5036eb60) ) ROM_LOAD( "epr-11113.152", 0x20000, 0x10000, CRC(36058c8c) SHA1(52befe6c6c53f10b6fd4971098abc8f8d3eef9d4) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-10932.90", 0x000000, 0x20000, CRC(cc0821d6) SHA1(22e84419a585209bbda1466d2180504c316a9b7f) ) // First 8 roms are MPR, the rest are EPR ROM_LOAD32_BYTE( "mpr-10934.94", 0x000001, 0x20000, CRC(4a51b1fa) SHA1(2eed018a5a1e935bb72b6f440a794466a1397dc5) ) ROM_LOAD32_BYTE( "mpr-10936.98", 0x000002, 0x20000, CRC(ada70d64) SHA1(ba6203b0fdb4c4998b7be5b446eb8354751d553a) ) ROM_LOAD32_BYTE( "mpr-10938.102", 0x000003, 0x20000, CRC(e7675baf) SHA1(aa979319a44c0b18c462afb5ca9cdeed2292c76a) ) ROM_LOAD32_BYTE( "mpr-10933.91", 0x080000, 0x20000, CRC(c8efb2c3) SHA1(ba31da93f929f2c457e60b2099d5a1ba6b5a9f48) ) ROM_LOAD32_BYTE( "mpr-10935.95", 0x080001, 0x20000, CRC(c1e23521) SHA1(5e95f3b6ff9f4caca676eaa6c84f1200315218ea) ) ROM_LOAD32_BYTE( "mpr-10937.99", 0x080002, 0x20000, CRC(f0199658) SHA1(cd67504fef53f637a3b1c723c4a04148f88028d2) ) ROM_LOAD32_BYTE( "mpr-10939.103", 0x080003, 0x20000, CRC(a0d49480) SHA1(6c4234456bc09ae771beec284d7aa21ebe474f6f) ) ROM_LOAD32_BYTE( "epr-11103.92", 0x100000, 0x20000, CRC(bdd60da2) SHA1(01673837c5ad84fa087728a05549ac01542ef4e9) ) ROM_LOAD32_BYTE( "epr-11104.96", 0x100001, 0x20000, CRC(06a35fce) SHA1(c39ae02fc8246e883c4f4c320f668ce6ca9c845a) ) ROM_LOAD32_BYTE( "epr-11105.100", 0x100002, 0x20000, CRC(027b0689) SHA1(c704c79faadb5e445fd3bd9281683b09831782d2) ) ROM_LOAD32_BYTE( "epr-11106.104", 0x100003, 0x20000, CRC(9e1fec09) SHA1(6cc47d86852b988bfcd64cb4ed7d832c683e3114) ) ROM_LOAD32_BYTE( "epr-11116.93", 0x180000, 0x20000, CRC(49b4c1ba) SHA1(5419f49f091e386eead4ccf5e03f12769e278179) ) ROM_LOAD32_BYTE( "epr-11117.97", 0x180001, 0x20000, CRC(821fbb71) SHA1(be2366d7b4a3a2543ba5024f0e258f1bc43caec8) ) ROM_LOAD32_BYTE( "epr-11118.101", 0x180002, 0x20000, CRC(8f38540b) SHA1(1fdfb157d1aca96cb635bd3d64f94545eb88c133) ) ROM_LOAD32_BYTE( "epr-11119.105", 0x180003, 0x20000, CRC(d0343a8e) SHA1(8c0c0addb6dfd0ea04c3900a9f7f7c731ca6e9ea) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx ROM_LOAD( "epr-10922.40", 0x000000, 0x10000, CRC(b49183d4) SHA1(71d87bfbce858049ccde9597ab15575b3cdba892) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-11112.17", 0x00000, 0x10000, CRC(d777fc6d) SHA1(46ce1c3875437044c0a172960d560d6acd6eaa92) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-10931.11", 0x00000, 0x20000, CRC(9209068f) SHA1(01f3dda1c066d00080c55f2c86c506b6b2407f98) ) ROM_LOAD( "mpr-10930.12", 0x20000, 0x20000, CRC(6493368b) SHA1(328aff19ff1d1344e9115f519d3962390c4e5ba4) ) ROM_LOAD( "epr-11102.13", 0x40000, 0x20000, CRC(6c07c78d) SHA1(3868b1824f43e4f2b4fbcd9274bfb3000c889d12) ) ROM_END //************************************************************************************************************************* // Afterburner II (German), Sega X-board // CPU: 68000 (317-????) // Sega Game ID #: 834-6335-04 AFTER BURNER // ROM_START( aburner2g ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-11173a.58", 0x00000, 0x20000, CRC(cbf480f4) SHA1(f5bab7b2889cdd3f3f2a3e9edd3f17b4d2a5b8a9) ) ROM_LOAD16_BYTE( "epr-11174a.63", 0x00001, 0x20000, CRC(ed7cba77) SHA1(e81f24fa93329ad25150eada7717cce55fa3887d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-11109.20", 0x00000, 0x20000, CRC(85a0fe07) SHA1(5a3a8fda6cb4898cfece4ec865b81b9b60f9ad55) ) ROM_LOAD16_BYTE( "epr-11110.29", 0x00001, 0x20000, CRC(f3d6797c) SHA1(17487b89ddbfbcc32a0b52268259f1c8d10fd0b2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-11115.154", 0x00000, 0x10000, CRC(e8e32921) SHA1(30a96e6b514a475c778296228ba5b6fb96b211b0) ) ROM_LOAD( "epr-11114.153", 0x10000, 0x10000, CRC(2e97f633) SHA1(074125c106dd00785903b2e10cd7e28d5036eb60) ) ROM_LOAD( "epr-11113.152", 0x20000, 0x10000, CRC(36058c8c) SHA1(52befe6c6c53f10b6fd4971098abc8f8d3eef9d4) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-10932.90", 0x000000, 0x20000, CRC(cc0821d6) SHA1(22e84419a585209bbda1466d2180504c316a9b7f) ) // First 8 roms are MPR, the rest are EPR ROM_LOAD32_BYTE( "mpr-10934.94", 0x000001, 0x20000, CRC(4a51b1fa) SHA1(2eed018a5a1e935bb72b6f440a794466a1397dc5) ) ROM_LOAD32_BYTE( "mpr-10936.98", 0x000002, 0x20000, CRC(ada70d64) SHA1(ba6203b0fdb4c4998b7be5b446eb8354751d553a) ) ROM_LOAD32_BYTE( "mpr-10938.102", 0x000003, 0x20000, CRC(e7675baf) SHA1(aa979319a44c0b18c462afb5ca9cdeed2292c76a) ) ROM_LOAD32_BYTE( "mpr-10933.91", 0x080000, 0x20000, CRC(c8efb2c3) SHA1(ba31da93f929f2c457e60b2099d5a1ba6b5a9f48) ) ROM_LOAD32_BYTE( "mpr-10935.95", 0x080001, 0x20000, CRC(c1e23521) SHA1(5e95f3b6ff9f4caca676eaa6c84f1200315218ea) ) ROM_LOAD32_BYTE( "mpr-10937.99", 0x080002, 0x20000, CRC(f0199658) SHA1(cd67504fef53f637a3b1c723c4a04148f88028d2) ) ROM_LOAD32_BYTE( "mpr-10939.103", 0x080003, 0x20000, CRC(a0d49480) SHA1(6c4234456bc09ae771beec284d7aa21ebe474f6f) ) ROM_LOAD32_BYTE( "epr-11094.92", 0x100000, 0x20000, CRC(bdd60da2) SHA1(01673837c5ad84fa087728a05549ac01542ef4e9) ) ROM_LOAD32_BYTE( "epr-11095.96", 0x100001, 0x20000, CRC(06a35fce) SHA1(c39ae02fc8246e883c4f4c320f668ce6ca9c845a) ) ROM_LOAD32_BYTE( "epr-11096.100", 0x100002, 0x20000, CRC(027b0689) SHA1(c704c79faadb5e445fd3bd9281683b09831782d2) ) ROM_LOAD32_BYTE( "epr-11097.104", 0x100003, 0x20000, CRC(9e1fec09) SHA1(6cc47d86852b988bfcd64cb4ed7d832c683e3114) ) ROM_LOAD32_BYTE( "epr-11116.93", 0x180000, 0x20000, CRC(49b4c1ba) SHA1(5419f49f091e386eead4ccf5e03f12769e278179) ) ROM_LOAD32_BYTE( "epr-11117.97", 0x180001, 0x20000, CRC(821fbb71) SHA1(be2366d7b4a3a2543ba5024f0e258f1bc43caec8) ) ROM_LOAD32_BYTE( "epr-11118.101", 0x180002, 0x20000, CRC(8f38540b) SHA1(1fdfb157d1aca96cb635bd3d64f94545eb88c133) ) ROM_LOAD32_BYTE( "epr-11119.105", 0x180003, 0x20000, CRC(d0343a8e) SHA1(8c0c0addb6dfd0ea04c3900a9f7f7c731ca6e9ea) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx ROM_LOAD( "epr-10922.40", 0x000000, 0x10000, CRC(b49183d4) SHA1(71d87bfbce858049ccde9597ab15575b3cdba892) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-11112.17", 0x00000, 0x10000, CRC(d777fc6d) SHA1(46ce1c3875437044c0a172960d560d6acd6eaa92) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-10931.11", 0x00000, 0x20000, CRC(9209068f) SHA1(01f3dda1c066d00080c55f2c86c506b6b2407f98) ) // There is known to exist German Sample roms ROM_LOAD( "mpr-10930.12", 0x20000, 0x20000, CRC(6493368b) SHA1(328aff19ff1d1344e9115f519d3962390c4e5ba4) ) ROM_LOAD( "epr-10929.13", 0x40000, 0x20000, CRC(6c07c78d) SHA1(3868b1824f43e4f2b4fbcd9274bfb3000c889d12) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Line of Fire, Sega X-board // CPU: FD1094 (317-0136) // Sega game ID# 834-7218-02 // ROM_START( loffire ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12849.58", 0x000000, 0x20000, CRC(61cfd2fe) SHA1(b47ae9cdf741574ab9128dd3556b1ef35e81a149) ) ROM_LOAD16_BYTE( "epr-12850.63", 0x000001, 0x20000, CRC(14598f2a) SHA1(13a51529ed32acefd733d9f638621c3e023dbd6d) ) // // It's not possible to determine the original value with just the available // ROM data. The choice was between 47, 56 and 57, which decrypt correctly all // the code at the affected addresses (2638, 6638 and so on). // I chose 57 because it's the only one that has only 1 bit different from the // bad value in the old dump (77). // // Nicola Salmoria // ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0136.key", 0x0000, 0x2000, BAD_DUMP CRC(344bfe0c) SHA1(f6bb8045b46f90f8abadf1dc2e1ae1d7cef9c810) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) ) ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) ) ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) ) ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) ) ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) ) ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) ) ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) ) ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) ) ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) ) ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) ) ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) ) ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) ) ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) ) ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) ) ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) ) ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) ) ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) ) ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) ) ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) ) ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) ) ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) ) ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) ) ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) ) ROM_END ROM_START( loffired ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12849.58", 0x000000, 0x20000, CRC(dfd1ab45) SHA1(dac358b6f50999deaed422578c2dcdfb492c81c9) ) ROM_LOAD16_BYTE( "bootleg_epr-12850.63", 0x000001, 0x20000, CRC(90889ae9) SHA1(254f8934e8a0329e28a38c71c4bd628ef7237ca8) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) ) ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) ) ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) ) ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) ) ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) ) ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) ) ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) ) ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) ) ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) ) ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) ) ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) ) ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) ) ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) ) ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) ) ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) ) ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) ) ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) ) ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) ) ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) ) ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) ) ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) ) ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) ) ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) ) ROM_END //************************************************************************************************************************* // Line of Fire, Sega X-board // CPU: FD1094 (317-0135) // Sega game ID# 834-7218-01 // ROM_START( loffireu ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12847a.58", 0x000000, 0x20000, CRC(c50eb4ed) SHA1(18a46c97aec2fefd160338c1760b6ee367dcb57f) ) ROM_LOAD16_BYTE( "epr-12848a.63", 0x000001, 0x20000, CRC(f8ff8640) SHA1(193bb8f42f3c5011ad1fbf87215f012de5e950fb) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0135.key", 0x0000, 0x2000, CRC(c53ad019) SHA1(7e6dc2b35ebfeefb507d4d03f5a59574944177d1) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) ) ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) ) ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) ) ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) ) ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) ) ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) ) ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) ) ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) ) ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) ) ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) ) ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) ) ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) ) ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) ) ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) ) ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) ) ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) ) ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) ) ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) ) ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) ) ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) ) ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) ) ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) ) ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) ) ROM_END ROM_START( loffireud ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12847a.58", 0x000000, 0x20000, CRC(74d270d0) SHA1(88819b4a4b49e4f02fdb4a617e2548a82ce7e835) ) ROM_LOAD16_BYTE( "bootleg_epr-12848a.63", 0x000001, 0x20000, CRC(7f27e058) SHA1(98401f992e4feb9141dc802edaaaa09eedfa8817) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) ) ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) ) ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) ) ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) ) ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) ) ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) ) ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) ) ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) ) ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) ) ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) ) ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) ) ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) ) ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) ) ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) ) ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) ) ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) ) ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) ) ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) ) ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) ) ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) ) ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) ) ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) ) ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) ) ROM_END //************************************************************************************************************************* // Line of Fire, Sega X-board // CPU: FD1094 (317-0134) // Sega game ID# 834-7218 // ROM_START( loffirej ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code // repaired using data from the loffire set since they are mostly identical // when decrypted, they pass the rom check so are assumed to be ok but double // checking them when possible never hurts ROM_LOAD16_BYTE( "epr-12794.58", 0x000000, 0x20000, CRC(1e588992) SHA1(fe7107e83c12643e7d22fd4b4cd0c7bcff0d84c3) ) ROM_LOAD16_BYTE( "epr-12795.63", 0x000001, 0x20000, CRC(d43d7427) SHA1(ecbd425bab6aa65ffbd441d6a0936ac055d5f06d) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0134.key", 0x0000, 0x2000, CRC(732626d4) SHA1(75ed7ca417758dd62afb4edbb9daee754932c392) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) ) ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) ) ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) ) ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) ) ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) ) ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) ) ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) ) ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) ) ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) ) ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) ) ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) ) ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) ) ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) ) ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) ) ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) ) ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) ) ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) ) ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) ) ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) ) ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) ) ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) ) ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) ) ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) ) ROM_END ROM_START( loffirejd ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12794.58", 0x000000, 0x20000, CRC(795f110d) SHA1(1592c618d21932490555c5fdf376429dfae00a95) ) ROM_LOAD16_BYTE( "bootleg_epr-12795.63", 0x000001, 0x20000, CRC(87c52aaa) SHA1(179d735966e46dc2e9d61047038224699c1956ed) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) ) ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) ) ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) ) ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) ) ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) ) ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) ) ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) ) ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) ) ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) ) ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) ) ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) ) ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) ) ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) ) ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) ) ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) ) ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) ) ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) ) ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) ) ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) ) ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) ) ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) ) ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) ) ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Thunder Blade, Sega X-board // CPU: FD1094 (317-0056) // // GAME BD NO. 834-6493-03 (Uses "MPR" mask roms) or 834-6493-05 (Uses "EPR" eproms) // ROM_START( thndrbld ) ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-11405.ic58", 0x000000, 0x20000, CRC(e057dd5a) SHA1(4c032db4752dfb44dba3def5ee5377fffd94b79c) ) ROM_LOAD16_BYTE( "epr-11406.ic63", 0x000001, 0x20000, CRC(c6b994b8) SHA1(098b2ae30c4aafea35222369d60f8e89f87639eb) ) ROM_LOAD16_BYTE( "epr-11306.ic57", 0x040000, 0x20000, CRC(4b95f2b4) SHA1(9e0ff898a2af05c35db3551e52c7485748698c28) ) ROM_LOAD16_BYTE( "epr-11307.ic62", 0x040001, 0x20000, CRC(2d6833e4) SHA1(b39a744370014237121f0010d18897e63f7058cf) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0056.key", 0x0000, 0x2000, CRC(b40cd2c5) SHA1(865e70bce4f55f6702960d6eaa780b7b1f880e41) ) ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-11390.ic20", 0x000000, 0x20000, CRC(ed988fdb) SHA1(b809b0b7dabd5cb29f5387522c6dfb993d1d0271) ) ROM_LOAD16_BYTE( "epr-11391.ic29", 0x000001, 0x20000, CRC(12523bc1) SHA1(54635d6c4cc97cf4148dcac3bb2056fc414252f7) ) ROM_LOAD16_BYTE( "epr-11310.ic21", 0x040000, 0x20000, CRC(5d9fa02c) SHA1(0ca71e35cf9740e38a52960f7d1ef96e7e1dda94) ) ROM_LOAD16_BYTE( "epr-11311.ic30", 0x040001, 0x20000, CRC(483de21b) SHA1(871f0e856dcc81dcef1d9846261b3c011fa26dde) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-11314.ic154", 0x00000, 0x10000, CRC(d4f954a9) SHA1(93ee8cf8fcf4e1d0dd58329bba9b594431193449) ) ROM_LOAD( "epr-11315.ic153", 0x10000, 0x10000, CRC(35813088) SHA1(ea1ec982d1509efb26e7b6a150825a6a905efed9) ) ROM_LOAD( "epr-11316.ic152", 0x20000, 0x10000, CRC(84290dff) SHA1(c13fb6ef12a991f79a95072f953a02b5c992aa2d) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-11323.ic90", 0x000000, 0x20000, CRC(27e40735) SHA1(284ddb88efe741fb78199ea619c9b230ee689803) ) ROM_LOAD32_BYTE( "epr-11322.ic94", 0x000001, 0x20000, CRC(10364d74) SHA1(393b19a972b5d8817ffd438f13ded73cd58ebe56) ) ROM_LOAD32_BYTE( "epr-11321.ic98", 0x000002, 0x20000, CRC(8e738f58) SHA1(9f2dceebf01e582cf60f072ae411000d8503894b) ) ROM_LOAD32_BYTE( "epr-11320.ic102", 0x000003, 0x20000, CRC(a95c76b8) SHA1(cda62f3c25b9414a523c2fc5d109031ed560069e) ) ROM_LOAD32_BYTE( "epr-11327.ic91", 0x080000, 0x20000, CRC(deae90f1) SHA1(c73c23bab949041242302cec13d653dcc71bb944) ) ROM_LOAD32_BYTE( "epr-11326.ic95", 0x080001, 0x20000, CRC(29198403) SHA1(3ecf315a0e6b3ed5005f8bdcb2e2a884c8b176c7) ) ROM_LOAD32_BYTE( "epr-11325.ic99", 0x080002, 0x20000, CRC(b9e98ae9) SHA1(c4932e2590b10d54fa8ded94593dc4203fccc60d) ) ROM_LOAD32_BYTE( "epr-11324.ic103", 0x080003, 0x20000, CRC(9742b552) SHA1(922032264d469e943dfbcaaf57464efc638fcf73) ) ROM_LOAD32_BYTE( "epr-11331.ic92", 0x100000, 0x20000, CRC(3a2c042e) SHA1(c296ff222d156d3bdcb42bef321831f502830fd6) ) ROM_LOAD32_BYTE( "epr-11330.ic96", 0x100001, 0x20000, CRC(aa7c70c5) SHA1(b6fea17392b7821b8b3bba78002f9c1604f09edc) ) ROM_LOAD32_BYTE( "epr-11329.ic100", 0x100002, 0x20000, CRC(31b20257) SHA1(7ce10a94bce67b2d15d7b576b0f7d47389dc8948) ) ROM_LOAD32_BYTE( "epr-11328.ic104", 0x100003, 0x20000, CRC(da39e89c) SHA1(526549ce9112754c82743552eeebec63fe7ad968) ) ROM_LOAD32_BYTE( "epr-11395.ic93", 0x180000, 0x20000, CRC(90775579) SHA1(15a86071a105da40ec9c0c0074e342231fc030d0) ) // ROM_LOAD32_BYTE( "epr-11394.ic97", 0x180001, 0x20000, CRC(5f2783be) SHA1(424510153a91902901f321f39738a862d6fba8e7) ) // different numbers? ROM_LOAD32_BYTE( "epr-11393.ic101", 0x180002, 0x20000, CRC(525e2e1d) SHA1(6fd09f775e7e6cad8078513d1af0a8ff40fb1360) ) // replaced from original rev? ROM_LOAD32_BYTE( "epr-11392.ic105", 0x180003, 0x20000, CRC(b4a382f7) SHA1(c03a05ba521f654db1a9c5f5717b7a15e5a29d4e) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data ROM_LOAD( "epr-11313.ic29", 0x00000, 0x10000, CRC(6a56c4c3) SHA1(c1b8023cb2ba4e96be052031c24b6ae424225c71) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-11396.ic17", 0x00000, 0x10000, CRC(d37b54a4) SHA1(c230fe7241a1f13ca13506d1492f348f506c40a7) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-11317.ic11", 0x00000, 0x20000, CRC(d4e7ac1f) SHA1(ec5d6e4949938adf56e5613801ae56ff2c3dede5) ) ROM_LOAD( "epr-11318.ic12", 0x20000, 0x20000, CRC(70d3f02c) SHA1(391aac2bc5673e06150de27e19c7c6359da8ca82) ) ROM_LOAD( "epr-11319.ic13", 0x40000, 0x20000, CRC(50d9242e) SHA1(a106371bf680c3088ec61f07fc5c4ce467973c15) ) ROM_END ROM_START( thndrbldd ) ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-11405.ic58", 0x000000, 0x20000, CRC(1642fd59) SHA1(92b95d97b1eef770983c993d357e06ecf6a2b29c) ) ROM_LOAD16_BYTE( "bootleg_epr-11406.ic63", 0x000001, 0x20000, CRC(aa87dd75) SHA1(4c61dfef69a68d9cab8fed0d2cbb28b751319049) ) ROM_LOAD16_BYTE( "epr-11306.ic57", 0x040000, 0x20000, CRC(4b95f2b4) SHA1(9e0ff898a2af05c35db3551e52c7485748698c28) ) ROM_LOAD16_BYTE( "epr-11307.ic62", 0x040001, 0x20000, CRC(2d6833e4) SHA1(b39a744370014237121f0010d18897e63f7058cf) ) ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-11390.ic20", 0x000000, 0x20000, CRC(ed988fdb) SHA1(b809b0b7dabd5cb29f5387522c6dfb993d1d0271) ) ROM_LOAD16_BYTE( "epr-11391.ic29", 0x000001, 0x20000, CRC(12523bc1) SHA1(54635d6c4cc97cf4148dcac3bb2056fc414252f7) ) ROM_LOAD16_BYTE( "epr-11310.ic21", 0x040000, 0x20000, CRC(5d9fa02c) SHA1(0ca71e35cf9740e38a52960f7d1ef96e7e1dda94) ) ROM_LOAD16_BYTE( "epr-11311.ic30", 0x040001, 0x20000, CRC(483de21b) SHA1(871f0e856dcc81dcef1d9846261b3c011fa26dde) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-11314.ic154", 0x00000, 0x10000, CRC(d4f954a9) SHA1(93ee8cf8fcf4e1d0dd58329bba9b594431193449) ) ROM_LOAD( "epr-11315.ic153", 0x10000, 0x10000, CRC(35813088) SHA1(ea1ec982d1509efb26e7b6a150825a6a905efed9) ) ROM_LOAD( "epr-11316.ic152", 0x20000, 0x10000, CRC(84290dff) SHA1(c13fb6ef12a991f79a95072f953a02b5c992aa2d) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-11323.ic90", 0x000000, 0x20000, CRC(27e40735) SHA1(284ddb88efe741fb78199ea619c9b230ee689803) ) ROM_LOAD32_BYTE( "epr-11322.ic94", 0x000001, 0x20000, CRC(10364d74) SHA1(393b19a972b5d8817ffd438f13ded73cd58ebe56) ) ROM_LOAD32_BYTE( "epr-11321.ic98", 0x000002, 0x20000, CRC(8e738f58) SHA1(9f2dceebf01e582cf60f072ae411000d8503894b) ) ROM_LOAD32_BYTE( "epr-11320.ic102", 0x000003, 0x20000, CRC(a95c76b8) SHA1(cda62f3c25b9414a523c2fc5d109031ed560069e) ) ROM_LOAD32_BYTE( "epr-11327.ic91", 0x080000, 0x20000, CRC(deae90f1) SHA1(c73c23bab949041242302cec13d653dcc71bb944) ) ROM_LOAD32_BYTE( "epr-11326.ic95", 0x080001, 0x20000, CRC(29198403) SHA1(3ecf315a0e6b3ed5005f8bdcb2e2a884c8b176c7) ) ROM_LOAD32_BYTE( "epr-11325.ic99", 0x080002, 0x20000, CRC(b9e98ae9) SHA1(c4932e2590b10d54fa8ded94593dc4203fccc60d) ) ROM_LOAD32_BYTE( "epr-11324.ic103", 0x080003, 0x20000, CRC(9742b552) SHA1(922032264d469e943dfbcaaf57464efc638fcf73) ) ROM_LOAD32_BYTE( "epr-11331.ic92", 0x100000, 0x20000, CRC(3a2c042e) SHA1(c296ff222d156d3bdcb42bef321831f502830fd6) ) ROM_LOAD32_BYTE( "epr-11330.ic96", 0x100001, 0x20000, CRC(aa7c70c5) SHA1(b6fea17392b7821b8b3bba78002f9c1604f09edc) ) ROM_LOAD32_BYTE( "epr-11329.ic100", 0x100002, 0x20000, CRC(31b20257) SHA1(7ce10a94bce67b2d15d7b576b0f7d47389dc8948) ) ROM_LOAD32_BYTE( "epr-11328.ic104", 0x100003, 0x20000, CRC(da39e89c) SHA1(526549ce9112754c82743552eeebec63fe7ad968) ) ROM_LOAD32_BYTE( "epr-11395.ic93", 0x180000, 0x20000, CRC(90775579) SHA1(15a86071a105da40ec9c0c0074e342231fc030d0) ) // ROM_LOAD32_BYTE( "epr-11394.ic97", 0x180001, 0x20000, CRC(5f2783be) SHA1(424510153a91902901f321f39738a862d6fba8e7) ) // different numbers? ROM_LOAD32_BYTE( "epr-11393.ic101", 0x180002, 0x20000, CRC(525e2e1d) SHA1(6fd09f775e7e6cad8078513d1af0a8ff40fb1360) ) // replaced from original rev? ROM_LOAD32_BYTE( "epr-11392.ic105", 0x180003, 0x20000, CRC(b4a382f7) SHA1(c03a05ba521f654db1a9c5f5717b7a15e5a29d4e) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data ROM_LOAD( "epr-11313.ic29", 0x00000, 0x10000, CRC(6a56c4c3) SHA1(c1b8023cb2ba4e96be052031c24b6ae424225c71) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-11396.ic17", 0x00000, 0x10000, CRC(d37b54a4) SHA1(c230fe7241a1f13ca13506d1492f348f506c40a7) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-11317.ic11", 0x00000, 0x20000, CRC(d4e7ac1f) SHA1(ec5d6e4949938adf56e5613801ae56ff2c3dede5) ) ROM_LOAD( "epr-11318.ic12", 0x20000, 0x20000, CRC(70d3f02c) SHA1(391aac2bc5673e06150de27e19c7c6359da8ca82) ) ROM_LOAD( "epr-11319.ic13", 0x40000, 0x20000, CRC(50d9242e) SHA1(a106371bf680c3088ec61f07fc5c4ce467973c15) ) ROM_END //************************************************************************************************************************* // Thunder Blade (Japan), Sega X-board // CPU: MC68000 // // GAME BD NO. 834-6493-03 (Uses "MPR" mask roms) or 834-6493-05 (Uses "EPR" eproms) // ROM_START( thndrbld1 ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-11304.ic58", 0x000000, 0x20000, CRC(a90630ef) SHA1(8f29e020119b2243b1c95e15546af1773327ae85) ) // patched? ROM_LOAD16_BYTE( "epr-11305.ic63", 0x000001, 0x20000, CRC(9ba3ef61) SHA1(f75748b37ce35b0ef881804f73417643068dfbb2) ) // patched? ROM_LOAD16_BYTE( "epr-11306.ic57", 0x040000, 0x20000, CRC(4b95f2b4) SHA1(9e0ff898a2af05c35db3551e52c7485748698c28) ) ROM_LOAD16_BYTE( "epr-11307.ic62", 0x040001, 0x20000, CRC(2d6833e4) SHA1(b39a744370014237121f0010d18897e63f7058cf) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-11308.ic20", 0x00000, 0x20000, CRC(7956c238) SHA1(4608225cfd6ea3d38317cbe970f26a5fc2f8e320) ) ROM_LOAD16_BYTE( "epr-11309.ic29", 0x00001, 0x20000, CRC(c887f620) SHA1(644c47cc2cf75cbe489ea084c13c59d94631e83f) ) ROM_LOAD16_BYTE( "epr-11310.ic21", 0x040000, 0x20000, CRC(5d9fa02c) SHA1(0ca71e35cf9740e38a52960f7d1ef96e7e1dda94) ) ROM_LOAD16_BYTE( "epr-11311.ic30", 0x040001, 0x20000, CRC(483de21b) SHA1(871f0e856dcc81dcef1d9846261b3c011fa26dde) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-11314.ic154", 0x00000, 0x10000, CRC(d4f954a9) SHA1(93ee8cf8fcf4e1d0dd58329bba9b594431193449) ) ROM_LOAD( "epr-11315.ic153", 0x10000, 0x10000, CRC(35813088) SHA1(ea1ec982d1509efb26e7b6a150825a6a905efed9) ) ROM_LOAD( "epr-11316.ic152", 0x20000, 0x10000, CRC(84290dff) SHA1(c13fb6ef12a991f79a95072f953a02b5c992aa2d) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-11323.ic90", 0x000000, 0x20000, CRC(27e40735) SHA1(284ddb88efe741fb78199ea619c9b230ee689803) ) ROM_LOAD32_BYTE( "epr-11322.ic94", 0x000001, 0x20000, CRC(10364d74) SHA1(393b19a972b5d8817ffd438f13ded73cd58ebe56) ) ROM_LOAD32_BYTE( "epr-11321.ic98", 0x000002, 0x20000, CRC(8e738f58) SHA1(9f2dceebf01e582cf60f072ae411000d8503894b) ) ROM_LOAD32_BYTE( "epr-11320.ic102", 0x000003, 0x20000, CRC(a95c76b8) SHA1(cda62f3c25b9414a523c2fc5d109031ed560069e) ) ROM_LOAD32_BYTE( "epr-11327.ic91", 0x080000, 0x20000, CRC(deae90f1) SHA1(c73c23bab949041242302cec13d653dcc71bb944) ) ROM_LOAD32_BYTE( "epr-11326.ic95", 0x080001, 0x20000, CRC(29198403) SHA1(3ecf315a0e6b3ed5005f8bdcb2e2a884c8b176c7) ) ROM_LOAD32_BYTE( "epr-11325.ic99", 0x080002, 0x20000, CRC(b9e98ae9) SHA1(c4932e2590b10d54fa8ded94593dc4203fccc60d) ) ROM_LOAD32_BYTE( "epr-11324.ic103", 0x080003, 0x20000, CRC(9742b552) SHA1(922032264d469e943dfbcaaf57464efc638fcf73) ) ROM_LOAD32_BYTE( "epr-11331.ic92", 0x100000, 0x20000, CRC(3a2c042e) SHA1(c296ff222d156d3bdcb42bef321831f502830fd6) ) ROM_LOAD32_BYTE( "epr-11330.ic96", 0x100001, 0x20000, CRC(aa7c70c5) SHA1(b6fea17392b7821b8b3bba78002f9c1604f09edc) ) ROM_LOAD32_BYTE( "epr-11329.ic100", 0x100002, 0x20000, CRC(31b20257) SHA1(7ce10a94bce67b2d15d7b576b0f7d47389dc8948) ) ROM_LOAD32_BYTE( "epr-11328.ic104", 0x100003, 0x20000, CRC(da39e89c) SHA1(526549ce9112754c82743552eeebec63fe7ad968) ) ROM_LOAD32_BYTE( "epr-11335.ic93", 0x180000, 0x20000, CRC(f19b3e86) SHA1(40e8ba10cd5020782b82279974d13330a9c015e5) ) ROM_LOAD32_BYTE( "epr-11334.ic97", 0x180001, 0x20000, CRC(348f91c7) SHA1(03da6a4fee1fdea76058be4bc5ffcde7a79e5948) ) ROM_LOAD32_BYTE( "epr-11333.ic101", 0x180002, 0x20000, CRC(05a2333f) SHA1(70f213945fa7fe056fe17a02558638e87f2c001e) ) ROM_LOAD32_BYTE( "epr-11332.ic105", 0x180003, 0x20000, CRC(dc089ec6) SHA1(d72390c45138a507e79af112addbc015560fc248) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data ROM_LOAD( "epr-11313.ic29", 0x00000, 0x10000, CRC(6a56c4c3) SHA1(c1b8023cb2ba4e96be052031c24b6ae424225c71) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-11312.ic17", 0x00000, 0x10000, CRC(3b974ed2) SHA1(cf18a2d0f01643c747a884bf00e5b7037ba2e64a) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-11317.ic11", 0x00000, 0x20000, CRC(d4e7ac1f) SHA1(ec5d6e4949938adf56e5613801ae56ff2c3dede5) ) ROM_LOAD( "epr-11318.ic12", 0x20000, 0x20000, CRC(70d3f02c) SHA1(391aac2bc5673e06150de27e19c7c6359da8ca82) ) ROM_LOAD( "epr-11319.ic13", 0x40000, 0x20000, CRC(50d9242e) SHA1(a106371bf680c3088ec61f07fc5c4ce467973c15) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Last Survivor, Sega X-board // CPU: FD1094 (317-0083) // ROM_START( lastsurv ) ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12046.ic58", 0x000000, 0x20000, CRC(f94f3a1a) SHA1(f509cbccb1f36ce52ed3e44d4d7b31a047050700) ) ROM_LOAD16_BYTE( "epr-12047.ic63", 0x000001, 0x20000, CRC(1b45c116) SHA1(c46ad622a145baea52d918537fa43a2009ed0cca) ) ROM_LOAD16_BYTE( "epr-12048.ic57", 0x040000, 0x20000, CRC(648e38ca) SHA1(e5f7fd42f49dbbddd1a812a04d8b95c1a73e640b) ) ROM_LOAD16_BYTE( "epr-12049.ic62", 0x040001, 0x20000, CRC(6c5c4753) SHA1(6834542005bc8cad7918ae17d3764306d7f9a959) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0083.key", 0x0000, 0x2000, CRC(dca0b9cc) SHA1(77510804d36d486ffa1e0bb5b0a36d43adc63415) ) ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12050.ic20", 0x000000, 0x20000, CRC(985a0f36) SHA1(bd0a93aa16565c8338db0c67b031bfa409bce5a9) ) ROM_LOAD16_BYTE( "epr-12051.ic29", 0x000001, 0x20000, CRC(f967d5a8) SHA1(16d742da755b5b7c3c3a9f6b4baaf242e5e54441) ) ROM_LOAD16_BYTE( "epr-12052.ic21", 0x040000, 0x20000, CRC(9f7a424d) SHA1(b8c2d3aa08ba71f08f2c1f403edac16bf4334184) ) ROM_LOAD16_BYTE( "epr-12053.ic30", 0x040001, 0x20000, CRC(efcf30f6) SHA1(55cd42c78f117995a89844529386ae3d11c718c1) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12055.ic154", 0x00000, 0x10000, CRC(150014a4) SHA1(9fbab916ee903c541f61014e137ccecd071b5c3a) ) ROM_LOAD( "epr-12056.ic153", 0x10000, 0x10000, CRC(3cd4c306) SHA1(b0f178688870c67936a15383024c392072e3bc66) ) ROM_LOAD( "epr-12057.ic152", 0x20000, 0x10000, CRC(37e91770) SHA1(69e26f4d3c4ebfaf0225a9b1c60038595929ef05) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12064.ic90", 0x000000, 0x20000, CRC(84562a69) SHA1(815189a65065def213ef171fe40a44a455dfe75a) ) ROM_LOAD32_BYTE( "mpr-12063.ic94", 0x000001, 0x20000, CRC(d163727c) SHA1(50ed2b401e107a359874dad5d86eec788f5504eb) ) ROM_LOAD32_BYTE( "mpr-12062.ic98", 0x000002, 0x20000, CRC(6b57833b) SHA1(1d70894c81a4cd39f43067701a598d2c4fbffa58) ) ROM_LOAD32_BYTE( "mpr-12061.ic102", 0x000003, 0x20000, CRC(8907d5ba) SHA1(f4f9a19f3c27ef02314e59294a9658e2b20d52e0) ) ROM_LOAD32_BYTE( "epr-12068.ic91", 0x080000, 0x20000, CRC(8b12d342) SHA1(0356a413c2438e9c6c660454f03c0e24c6325f6b) ) ROM_LOAD32_BYTE( "epr-12067.ic95", 0x080001, 0x20000, CRC(1a1cdd89) SHA1(cd725aa450efa60ecc7d4111d0690cb441633935) ) ROM_LOAD32_BYTE( "epr-12066.ic99", 0x080002, 0x20000, CRC(a91d16b5) SHA1(501ddedf79130979c90c72882c2d96f5fd01adea) ) ROM_LOAD32_BYTE( "epr-12065.ic103", 0x080003, 0x20000, CRC(f4ce14c6) SHA1(42221ee03f363e94bf7b6de0bd89172525500412) ) ROM_LOAD32_BYTE( "epr-12072.ic92", 0x100000, 0x20000, CRC(222064c8) SHA1(a3914f8dabd8a3d99eaf4e03fa45e177c9f30666) ) ROM_LOAD32_BYTE( "epr-12071.ic96", 0x100001, 0x20000, CRC(a329b78c) SHA1(33b1f27dcc5ac36fdfd7374e1edda4fc31421126) ) ROM_LOAD32_BYTE( "epr-12070.ic100", 0x100002, 0x20000, CRC(97cc6706) SHA1(9160f100bd85f9c8b774e27a5d68e1c513111a61) ) ROM_LOAD32_BYTE( "epr-12069.ic104", 0x100003, 0x20000, CRC(2c3ba66e) SHA1(087fbf9d17f38b06b134088d89965c8d17dd5846) ) ROM_LOAD32_BYTE( "epr-12076.ic93", 0x180000, 0x20000, CRC(24f628e1) SHA1(abbc22282c7a9df203a8c589ddf08413d67392b1) ) ROM_LOAD32_BYTE( "epr-12075.ic97", 0x180001, 0x20000, CRC(69b3507f) SHA1(c447ceb38b473a3f65847471ef6de559e6ecce4a) ) ROM_LOAD32_BYTE( "epr-12074.ic101", 0x180002, 0x20000, CRC(ee6cbb73) SHA1(c68d825ded83dd06ba7b816622db3d57631b4fcc) ) ROM_LOAD32_BYTE( "epr-12073.ic105", 0x180003, 0x20000, CRC(167e6342) SHA1(2f87074d6821a974cbb137ca2bec28fafc0df46f) ) ROM_REGION( 0x20000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12054.ic17", 0x00000, 0x10000, CRC(e9b39216) SHA1(142764b40b4db69ff08d28338d1b12b1dd1ed0a0) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12058.ic11", 0x00000, 0x20000, CRC(4671cb46) SHA1(03ecaa4409a5b86a558313d4ccfb2334f79cff17) ) ROM_LOAD( "epr-12059.ic12", 0x20000, 0x20000, CRC(8c99aff4) SHA1(818418e4e92f601b09fcaa0979802a2c2c85b435) ) ROM_LOAD( "epr-12060.ic13", 0x40000, 0x20000, CRC(7ed382b3) SHA1(c87306d1b9edb8b4b97aee4af1317526750e2da2) ) ROM_END ROM_START( lastsurvd ) ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12046.ic58", 0x000000, 0x20000, CRC(ddef5278) SHA1(0efb4c6280f8127406d55461983137bac8f2a2c8) ) ROM_LOAD16_BYTE( "bootleg_epr-12047.ic63", 0x000001, 0x20000, CRC(3981a891) SHA1(b25a37e2a3e55f1ee370ca99e406959fb1db13d6) ) ROM_LOAD16_BYTE( "epr-12048.ic57", 0x040000, 0x20000, CRC(648e38ca) SHA1(e5f7fd42f49dbbddd1a812a04d8b95c1a73e640b) ) ROM_LOAD16_BYTE( "epr-12049.ic62", 0x040001, 0x20000, CRC(6c5c4753) SHA1(6834542005bc8cad7918ae17d3764306d7f9a959) ) ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12050.ic20", 0x000000, 0x20000, CRC(985a0f36) SHA1(bd0a93aa16565c8338db0c67b031bfa409bce5a9) ) ROM_LOAD16_BYTE( "epr-12051.ic29", 0x000001, 0x20000, CRC(f967d5a8) SHA1(16d742da755b5b7c3c3a9f6b4baaf242e5e54441) ) ROM_LOAD16_BYTE( "epr-12052.ic21", 0x040000, 0x20000, CRC(9f7a424d) SHA1(b8c2d3aa08ba71f08f2c1f403edac16bf4334184) ) ROM_LOAD16_BYTE( "epr-12053.ic30", 0x040001, 0x20000, CRC(efcf30f6) SHA1(55cd42c78f117995a89844529386ae3d11c718c1) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12055.ic154", 0x00000, 0x10000, CRC(150014a4) SHA1(9fbab916ee903c541f61014e137ccecd071b5c3a) ) ROM_LOAD( "epr-12056.ic153", 0x10000, 0x10000, CRC(3cd4c306) SHA1(b0f178688870c67936a15383024c392072e3bc66) ) ROM_LOAD( "epr-12057.ic152", 0x20000, 0x10000, CRC(37e91770) SHA1(69e26f4d3c4ebfaf0225a9b1c60038595929ef05) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12064.ic90", 0x000000, 0x20000, CRC(84562a69) SHA1(815189a65065def213ef171fe40a44a455dfe75a) ) ROM_LOAD32_BYTE( "mpr-12063.ic94", 0x000001, 0x20000, CRC(d163727c) SHA1(50ed2b401e107a359874dad5d86eec788f5504eb) ) ROM_LOAD32_BYTE( "mpr-12062.ic98", 0x000002, 0x20000, CRC(6b57833b) SHA1(1d70894c81a4cd39f43067701a598d2c4fbffa58) ) ROM_LOAD32_BYTE( "mpr-12061.ic102", 0x000003, 0x20000, CRC(8907d5ba) SHA1(f4f9a19f3c27ef02314e59294a9658e2b20d52e0) ) ROM_LOAD32_BYTE( "epr-12068.ic91", 0x080000, 0x20000, CRC(8b12d342) SHA1(0356a413c2438e9c6c660454f03c0e24c6325f6b) ) ROM_LOAD32_BYTE( "epr-12067.ic95", 0x080001, 0x20000, CRC(1a1cdd89) SHA1(cd725aa450efa60ecc7d4111d0690cb441633935) ) ROM_LOAD32_BYTE( "epr-12066.ic99", 0x080002, 0x20000, CRC(a91d16b5) SHA1(501ddedf79130979c90c72882c2d96f5fd01adea) ) ROM_LOAD32_BYTE( "epr-12065.ic103", 0x080003, 0x20000, CRC(f4ce14c6) SHA1(42221ee03f363e94bf7b6de0bd89172525500412) ) ROM_LOAD32_BYTE( "epr-12072.ic92", 0x100000, 0x20000, CRC(222064c8) SHA1(a3914f8dabd8a3d99eaf4e03fa45e177c9f30666) ) ROM_LOAD32_BYTE( "epr-12071.ic96", 0x100001, 0x20000, CRC(a329b78c) SHA1(33b1f27dcc5ac36fdfd7374e1edda4fc31421126) ) ROM_LOAD32_BYTE( "epr-12070.ic100", 0x100002, 0x20000, CRC(97cc6706) SHA1(9160f100bd85f9c8b774e27a5d68e1c513111a61) ) ROM_LOAD32_BYTE( "epr-12069.ic104", 0x100003, 0x20000, CRC(2c3ba66e) SHA1(087fbf9d17f38b06b134088d89965c8d17dd5846) ) ROM_LOAD32_BYTE( "epr-12076.ic93", 0x180000, 0x20000, CRC(24f628e1) SHA1(abbc22282c7a9df203a8c589ddf08413d67392b1) ) ROM_LOAD32_BYTE( "epr-12075.ic97", 0x180001, 0x20000, CRC(69b3507f) SHA1(c447ceb38b473a3f65847471ef6de559e6ecce4a) ) ROM_LOAD32_BYTE( "epr-12074.ic101", 0x180002, 0x20000, CRC(ee6cbb73) SHA1(c68d825ded83dd06ba7b816622db3d57631b4fcc) ) ROM_LOAD32_BYTE( "epr-12073.ic105", 0x180003, 0x20000, CRC(167e6342) SHA1(2f87074d6821a974cbb137ca2bec28fafc0df46f) ) ROM_REGION( 0x20000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12054.ic17", 0x00000, 0x10000, CRC(e9b39216) SHA1(142764b40b4db69ff08d28338d1b12b1dd1ed0a0) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12058.ic11", 0x00000, 0x20000, CRC(4671cb46) SHA1(03ecaa4409a5b86a558313d4ccfb2334f79cff17) ) ROM_LOAD( "epr-12059.ic12", 0x20000, 0x20000, CRC(8c99aff4) SHA1(818418e4e92f601b09fcaa0979802a2c2c85b435) ) ROM_LOAD( "epr-12060.ic13", 0x40000, 0x20000, CRC(7ed382b3) SHA1(c87306d1b9edb8b4b97aee4af1317526750e2da2) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Racing Hero, Sega X-board // CPU: FD1094 (317-0144) // ROM_START( rachero ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13129.ic58", 0x00000, 0x20000,CRC(ad9f32e7) SHA1(dbcb3436782bee88dcac05d4f59c97f170a7387d) ) ROM_LOAD16_BYTE( "epr-13130.ic63", 0x00001, 0x20000,CRC(6022777b) SHA1(965c76565d740be3355c4b403a1629cffb9fcd78) ) ROM_LOAD16_BYTE( "epr-12855.ic57", 0x40000, 0x20000,CRC(cecf1e73) SHA1(3f8631379f32dbfda7720ef345276f9be23ada06) ) ROM_LOAD16_BYTE( "epr-12856.ic62", 0x40001, 0x20000,CRC(da900ebb) SHA1(595ed65248185ddf8666b3f30ad6329162116448) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0144.key", 0x0000, 0x2000, CRC(8740bbff) SHA1(de96e606c04a09258b966532fb01a6b4d4db86a6) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12857.ic20", 0x00000, 0x20000, CRC(8a2328cc) SHA1(c34498428ddfb3eeb986f4153a6165a685d8fc8a) ) ROM_LOAD16_BYTE( "epr-12858.ic29", 0x00001, 0x20000, CRC(38a248b7) SHA1(a17672123665403c1c56fedab6c8abf44b1131f9) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12879.ic154", 0x00000, 0x10000, CRC(c1a9de7a) SHA1(2425456a9d4ba92e1f2da6c2f164a6d5a5dee7c7) ) ROM_LOAD( "epr-12880.ic153", 0x10000, 0x10000, CRC(27ff04a5) SHA1(b554a6e060f4803100be8efa52977b503eb0f31d) ) ROM_LOAD( "epr-12881.ic152", 0x20000, 0x10000, CRC(72f14491) SHA1(b7a6cbd08470a5edda77cdd0337abd502c4905fd) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12872.ic90", 0x000000, 0x20000, CRC(68d56139) SHA1(b5f32edbda10c31d52f90defea2bae226676069f) ) ROM_LOAD32_BYTE( "epr-12873.ic94", 0x000001, 0x20000, CRC(3d3ec450) SHA1(ac96ad8c7b365478bd1e5826a073e242f1208247) ) ROM_LOAD32_BYTE( "epr-12874.ic98", 0x000002, 0x20000, CRC(7d6bde23) SHA1(88b12ec6386cdad60b0028b72033a0037a0cdbdb) ) ROM_LOAD32_BYTE( "epr-12875.ic102", 0x000003, 0x20000, CRC(e33092bf) SHA1(31e211e25adac0a98befb459093f23c905fbc1e6) ) ROM_LOAD32_BYTE( "epr-12868.ic91", 0x080000, 0x20000, CRC(96289583) SHA1(4d37e67860bc0e6ef69f0a0775c28f6f2fd6875e) ) ROM_LOAD32_BYTE( "epr-12869.ic95", 0x080001, 0x20000, CRC(2ef0de02) SHA1(11ee3d77df2cddd3156da52e50565505f95f4cd4) ) ROM_LOAD32_BYTE( "epr-12870.ic99", 0x080002, 0x20000, CRC(c76630e1) SHA1(7b76e4819990e147639d6b930b17b6fa10df191c) ) ROM_LOAD32_BYTE( "epr-12871.ic103", 0x080003, 0x20000, CRC(23401b1a) SHA1(eaf465ffda84bdb83cc85daf781275bada396aab) ) ROM_LOAD32_BYTE( "epr-12864.ic92", 0x100000, 0x20000, CRC(77d6cff4) SHA1(1e625204801d03369311844efb26d22216253ac4) ) ROM_LOAD32_BYTE( "epr-12865.ic96", 0x100001, 0x20000, CRC(1e7e685b) SHA1(532fe361357383aa9dada833cbe31716c58001e5) ) ROM_LOAD32_BYTE( "epr-12866.ic100", 0x100002, 0x20000, CRC(fdf31329) SHA1(9c229a0f9d8b8114acfe4f17b45a9b8640560b3e) ) ROM_LOAD32_BYTE( "epr-12867.ic104", 0x100003, 0x20000, CRC(b25e37fd) SHA1(fef5bfe4690b3203b83fd565d883b2c63f439633) ) ROM_LOAD32_BYTE( "epr-12860.ic93", 0x180000, 0x20000, CRC(86b64119) SHA1(d39aedad0f05e500e33af888126bd2fc22539141) ) ROM_LOAD32_BYTE( "epr-12861.ic97", 0x180001, 0x20000, CRC(bccff19b) SHA1(32c3f7802a12be02a114b78cd898c46fcb1c0a61) ) ROM_LOAD32_BYTE( "epr-12862.ic101", 0x180002, 0x20000, CRC(7d4c3b05) SHA1(4e25a077b403549c681c5047912d0e28f4c07720) ) ROM_LOAD32_BYTE( "epr-12863.ic105", 0x180003, 0x20000, CRC(85095053) SHA1(f93194ecc0300956280cc0515b3e3ba2c9f71364) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12859.ic17", 0x00000, 0x10000, CRC(d57881da) SHA1(75b7f331ea8c2e33d6236e0c8fc8dabe5eef8160) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12876.ic11", 0x00000, 0x20000, CRC(f72a34a0) SHA1(28f7d077c24352557da3a91a7e49b0c5b79f2a2e) ) ROM_LOAD( "epr-12877.ic12", 0x20000, 0x20000, CRC(18c1b6d2) SHA1(860cbb96999ab76c40ce96996bba70c42d845abc) ) ROM_LOAD( "epr-12878.ic13", 0x40000, 0x20000, CRC(7c212c15) SHA1(360b332d2fb32d88949ff8b357a863ffaaca39c2) ) ROM_END ROM_START( racherod ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-13129.ic58", 0x00000, 0x20000, CRC(82ee7312) SHA1(4d011529b538885bbc3bb1cb23048b785d3be318) ) ROM_LOAD16_BYTE( "bootleg_epr-13130.ic63", 0x00001, 0x20000, CRC(53fb8649) SHA1(8b66d6e2018f92c7c992944ed5d4a685d9f13a6d) ) ROM_LOAD16_BYTE( "epr-12855.ic57", 0x40000, 0x20000,CRC(cecf1e73) SHA1(3f8631379f32dbfda7720ef345276f9be23ada06) ) ROM_LOAD16_BYTE( "epr-12856.ic62", 0x40001, 0x20000,CRC(da900ebb) SHA1(595ed65248185ddf8666b3f30ad6329162116448) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12857.ic20", 0x00000, 0x20000, CRC(8a2328cc) SHA1(c34498428ddfb3eeb986f4153a6165a685d8fc8a) ) ROM_LOAD16_BYTE( "epr-12858.ic29", 0x00001, 0x20000, CRC(38a248b7) SHA1(a17672123665403c1c56fedab6c8abf44b1131f9) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12879.ic154", 0x00000, 0x10000, CRC(c1a9de7a) SHA1(2425456a9d4ba92e1f2da6c2f164a6d5a5dee7c7) ) ROM_LOAD( "epr-12880.ic153", 0x10000, 0x10000, CRC(27ff04a5) SHA1(b554a6e060f4803100be8efa52977b503eb0f31d) ) ROM_LOAD( "epr-12881.ic152", 0x20000, 0x10000, CRC(72f14491) SHA1(b7a6cbd08470a5edda77cdd0337abd502c4905fd) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-12872.ic90", 0x000000, 0x20000, CRC(68d56139) SHA1(b5f32edbda10c31d52f90defea2bae226676069f) ) ROM_LOAD32_BYTE( "epr-12873.ic94", 0x000001, 0x20000, CRC(3d3ec450) SHA1(ac96ad8c7b365478bd1e5826a073e242f1208247) ) ROM_LOAD32_BYTE( "epr-12874.ic98", 0x000002, 0x20000, CRC(7d6bde23) SHA1(88b12ec6386cdad60b0028b72033a0037a0cdbdb) ) ROM_LOAD32_BYTE( "epr-12875.ic102", 0x000003, 0x20000, CRC(e33092bf) SHA1(31e211e25adac0a98befb459093f23c905fbc1e6) ) ROM_LOAD32_BYTE( "epr-12868.ic91", 0x080000, 0x20000, CRC(96289583) SHA1(4d37e67860bc0e6ef69f0a0775c28f6f2fd6875e) ) ROM_LOAD32_BYTE( "epr-12869.ic95", 0x080001, 0x20000, CRC(2ef0de02) SHA1(11ee3d77df2cddd3156da52e50565505f95f4cd4) ) ROM_LOAD32_BYTE( "epr-12870.ic99", 0x080002, 0x20000, CRC(c76630e1) SHA1(7b76e4819990e147639d6b930b17b6fa10df191c) ) ROM_LOAD32_BYTE( "epr-12871.ic103", 0x080003, 0x20000, CRC(23401b1a) SHA1(eaf465ffda84bdb83cc85daf781275bada396aab) ) ROM_LOAD32_BYTE( "epr-12864.ic92", 0x100000, 0x20000, CRC(77d6cff4) SHA1(1e625204801d03369311844efb26d22216253ac4) ) ROM_LOAD32_BYTE( "epr-12865.ic96", 0x100001, 0x20000, CRC(1e7e685b) SHA1(532fe361357383aa9dada833cbe31716c58001e5) ) ROM_LOAD32_BYTE( "epr-12866.ic100", 0x100002, 0x20000, CRC(fdf31329) SHA1(9c229a0f9d8b8114acfe4f17b45a9b8640560b3e) ) ROM_LOAD32_BYTE( "epr-12867.ic104", 0x100003, 0x20000, CRC(b25e37fd) SHA1(fef5bfe4690b3203b83fd565d883b2c63f439633) ) ROM_LOAD32_BYTE( "epr-12860.ic93", 0x180000, 0x20000, CRC(86b64119) SHA1(d39aedad0f05e500e33af888126bd2fc22539141) ) ROM_LOAD32_BYTE( "epr-12861.ic97", 0x180001, 0x20000, CRC(bccff19b) SHA1(32c3f7802a12be02a114b78cd898c46fcb1c0a61) ) ROM_LOAD32_BYTE( "epr-12862.ic101", 0x180002, 0x20000, CRC(7d4c3b05) SHA1(4e25a077b403549c681c5047912d0e28f4c07720) ) ROM_LOAD32_BYTE( "epr-12863.ic105", 0x180003, 0x20000, CRC(85095053) SHA1(f93194ecc0300956280cc0515b3e3ba2c9f71364) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data // none ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12859.ic17", 0x00000, 0x10000, CRC(d57881da) SHA1(75b7f331ea8c2e33d6236e0c8fc8dabe5eef8160) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-12876.ic11", 0x00000, 0x20000, CRC(f72a34a0) SHA1(28f7d077c24352557da3a91a7e49b0c5b79f2a2e) ) ROM_LOAD( "epr-12877.ic12", 0x20000, 0x20000, CRC(18c1b6d2) SHA1(860cbb96999ab76c40ce96996bba70c42d845abc) ) ROM_LOAD( "epr-12878.ic13", 0x40000, 0x20000, CRC(7c212c15) SHA1(360b332d2fb32d88949ff8b357a863ffaaca39c2) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0126a) // This set is coming from a twin. // // This set has an extra link board (834-7112) or 171-5729-01 under the main board with a Z80 // // Xtal is 16.000 Mhz. // // It has also one eprom (Epr 12587.14) two pal 16L8 (315-5336 and 315-5337) and two // fujitsu IC MB89372P and MB8421-12LP // // Main Board : (834-8180-02) // // epr-12576A.20 (68000) // epr-12577A.29 (68000) // epr-12563B.58 FD1094 317-0126A // epr-12564B.63 FD1094 317-0126A // epr-12609.93 // epr-12610.97 // epr-12611.101 // epr-12612.105 // mpr-12417.92 // mpr-12418.96 // mpr-12419.100 // mpr-12420.104 // mpr-12421.91 // mpr-12422.95 // mpr-12423.99 // mpr-12424.103 // mpr-12425.90 // mpr-12426.94 // mpr-12427.98 // mpr-12428.102 // epr-12429.154 // epr-12430.153 // epr-12431.152 // epr-12436.17 // mpr-12437.11 // mpr-12438.12 // mpr-12439.13 // // Link Board : // // Ep12587.14 // ROM_START( smgp ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12563b.58", 0x00000, 0x20000, CRC(baf1f333) SHA1(f91a7a311237b9940a44b815716d4226a7ae1e8b) ) ROM_LOAD16_BYTE( "epr-12564b.63", 0x00001, 0x20000, CRC(b5191af0) SHA1(d6fb19552e4816eefe751907ec55a2e07ad24879) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0126a.key", 0x0000, 0x2000, CRC(2abc1982) SHA1(cc4c36e6ba52431df17c6e36ba08d3a89be7b7e7) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END ROM_START( smgpd ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12563b.58", 0x00000, 0x20000, CRC(af30e3cd) SHA1(b05a4f8be701fada6d55a042079f4b2067b52cb2) ) ROM_LOAD16_BYTE( "bootleg_epr-12564b.63", 0x00001, 0x20000, CRC(eb7cadfe) SHA1(58c2d05cd21795c1d5d603179decc3b861ef438f) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0126a) // // this set contained only prg roms ROM_START( smgp6 ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12563a.58", 0x00000, 0x20000, CRC(2e64b10e) SHA1(2be1ffb3120e4af6a61880e2a2602db07a73f373) ) ROM_LOAD16_BYTE( "epr-12564a.63", 0x00001, 0x20000, CRC(5baba3e7) SHA1(37194d5a4d3ee48a276f6aeb35b2f20a7661caa2) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0126a.key", 0x0000, 0x2000, CRC(2abc1982) SHA1(cc4c36e6ba52431df17c6e36ba08d3a89be7b7e7) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END ROM_START( smgp6d ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12563a.58", 0x00000, 0x20000, CRC(3ba5a1f0) SHA1(52ac3568f35a68afb458fe8d1f4c20029052100f) ) ROM_LOAD16_BYTE( "bootleg_epr-12564a.63", 0x00001, 0x20000, CRC(05ce14e9) SHA1(abc65f85b9d8710ef88c336df6584c194364dce5) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0126) // This set is coming from a deluxe. // // SEGA Monaco G.P. by SEGA 1989 // // This set is coming from a sitdown "air drive" version. // // This set has an extra sound board (837-7000) under the main board with a Z80 // and a few eproms, some of those eproms are already on the main board ! // // It has also an "air drive" board with a Z80 and one eprom. // // Main Board : (834-7016-05) // // epr-12576.20 (68000) // epr-12577.29 (68000) // epr-12563.58 FD1094 317-0126 // epr-12564.63 FD1094 317-0126 // epr-12413.93 // epr-12414.97 // epr-12415.101 // epr-12416.105 // mpr-12417.92 // mpr-12418.96 // mpr-12419.100 // mpr-12420.104 // mpr-12421.91 // mpr-12422.95 // mpr-12423.99 // mpr-12424.103 // mpr-12425.90 // mpr-12426.94 // mpr-12427.98 // mpr-12428.102 // epr-12429.154 // epr-12430.153 // epr-12431.152 // epr-12436.17 // mpr-12437.11 // mpr-12438.12 // IC 13 is not used ! // // Sound Board : // // epr-12535.8 // mpr-12437.20 // mpr-12438.21 // mpr-12439.22 // // Air Drive Board : // // Ep12505.8 // ROM_START( smgp5 ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12563.58", 0x00000, 0x20000, CRC(6d7325ae) SHA1(bf88ceddc49dab5b439080d5bf0e7e084a79546c) ) ROM_LOAD16_BYTE( "epr-12564.63", 0x00001, 0x20000, CRC(adfbf921) SHA1(f3321e03dc37b14db065b85d63e321810e4ea797) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0126.key", 0x0000, 0x2000, CRC(4d917996) SHA1(17232c0e35d439a12db3d966064cf00104088903) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12576.20", 0x00000, 0x20000, CRC(23266b26) SHA1(240b9bf198fd2975851e769766566ec4e8379f87) ) ROM_LOAD16_BYTE( "epr-12577.29", 0x00001, 0x20000, CRC(d5b53211) SHA1(b11f5c5094eb7ea9578f15489b00d8bbac1edee6) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) ) ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) ) ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) ) ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) ROM_END ROM_START( smgp5d ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12563.58", 0x00000, 0x20000, CRC(6c7f0549) SHA1(a9beed12e204acc5bf45dded9b3d4d1643b83a94) ) ROM_LOAD16_BYTE( "bootleg_epr-12564.63", 0x00001, 0x20000, CRC(c2b3a219) SHA1(d9299d2a0a93404f18148e9d2bd2d57cd043b67b) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12576.20", 0x00000, 0x20000, CRC(23266b26) SHA1(240b9bf198fd2975851e769766566ec4e8379f87) ) ROM_LOAD16_BYTE( "epr-12577.29", 0x00001, 0x20000, CRC(d5b53211) SHA1(b11f5c5094eb7ea9578f15489b00d8bbac1edee6) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) ) ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) ) ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) ) ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0125a) // ROM_START( smgpu ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12561c.58", 0x00000, 0x20000, CRC(a5b0f3fe) SHA1(17103e56f822fdb52e72f597c01415ed375aa102) ) ROM_LOAD16_BYTE( "epr-12562c.63", 0x00001, 0x20000, CRC(799e55f4) SHA1(2e02cdc63bda47b087c81021018287cfa961c083) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) ) ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END ROM_START( smgpud ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12561c.58", 0x00000, 0x20000, CRC(7053e379) SHA1(742e80e2ec2dedae1d6ba64fc563707790a30606) ) ROM_LOAD16_BYTE( "bootleg_epr-12562c.63", 0x00001, 0x20000, CRC(db848e75) SHA1(0750c981a70a2cc5dfae6ce27598865847ff3156) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) ) ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0125a) // // very first US version with demo sound on by default ROM_START( smgpu1 ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12561b.58", 0x00000, 0x20000, CRC(80a32655) SHA1(fe1ffa8af9f1ca175ba90b24a0853329b08d19af) ) ROM_LOAD16_BYTE( "epr-12562b.63", 0x00001, 0x20000, CRC(d525f2a8) SHA1(f3241e11485c7428cd9f081ec6768fda39ae3250) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) ) ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END ROM_START( smgpu1d ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12561.58", 0x00000, 0x20000, CRC(554036d2) SHA1(7f82c8e96342f5b01209e0fcf56bafbb06d06458) ) ROM_LOAD16_BYTE( "bootleg_epr-12562.63", 0x00001, 0x20000, CRC(773f2929) SHA1(aff10b08ed4cf1505228d8f2a785e71eeaea4089) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) ) ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0125a) // This set is coming from a twin. // // ROMs: // IC58 : epr-12561A.58 (27C010 EPROM) // IC57 : not populated // IC63 : epr-12562A.63 (27C010 EPROM) // IC62 : not populated // // IC11 : mpr-12437.11 (831000 MASKROM) // IC12 : mpr-12438.12 (831000 MASKROM) // IC13 : mpr-12439.13 (831000 MASKROM) // IC17 : epr-12436.17 (27C512 EPROM) // // IC21 : not populated // IC20 : epr-12574A.20 (27C010 EPROM) // IC30 : not populated // IC29 : epr-12575A.29 (27C010 EPROM) // // IC40 : not populated // // IC90 : mpr-12425.90 (831000 MASKROM) // IC91 : mpr-12421.91 (831000 MASKROM) // IC92 : mpr-12417.92 (831000 MASKROM) // IC93 : epr-12609.93 (27C010 EPROM) // // IC94 : mpr-12426.94 (831000 MASKROM) // IC95 : mpr-12422.95 (831000 MASKROM) // IC96 : mpr-12418.96 (831000 MASKROM) // IC97 : epr-12610.97 (27C010 EPROM) // // IC98 : mpr-12427.98 (831000 MASKROM) // IC99 : mpr-12423.99 (831000 MASKROM) // IC100: mpr-12419.100 (831000 MASKROM) // IC101: epr-12611.101 (27C010 EPROM) // // IC102: mpr-12428.102 (831000 MASKROM) // IC103: mpr-12424.103 (831000 MASKROM) // IC104: mpr-12420.104 (831000 MASKROM) // IC105: epr-12612.105 (27C010 EPROM) // // IC154: epr-12429.154 (27C512 EPROM) // IC153: epr-12430.153 (27C512 EPROM) // IC152: epr-12431.152 (27C512 EPROM) // ROM_START( smgpu2 ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12561a.58", 0x00000, 0x20000, CRC(e505eb89) SHA1(bfb9a7a8b13ae454a92349e57215562477cd2cd2) ) ROM_LOAD16_BYTE( "epr-12562a.63", 0x00001, 0x20000, CRC(c3af4215) SHA1(c46829e08d5492515de5d3269b0e899705d0b108) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) ) ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END ROM_START( smgpu2d ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12561a.58", 0x00000, 0x20000, CRC(30e6fb0e) SHA1(7cb079f7a1160e08a01ceebbcb528fb19bd3e5fb) ) ROM_LOAD16_BYTE( "bootleg_epr-12562a.63", 0x00001, 0x20000, CRC(61b59994) SHA1(e8bbac96321f85a170e4cddbe0c66bc7e21024f0) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) ) ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) // ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) // ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) // ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0124a) // ROM_START( smgpj ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12432b.58", 0x00000, 0x20000, CRC(c1a29db1) SHA1(0122d366899f98f7a60b0c9bddeece7995cebf83) ) ROM_LOAD16_BYTE( "epr-12433b.63", 0x00001, 0x20000, CRC(97199eb1) SHA1(3baccf8159821d4b4d5caedf5eb691f07372be93) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0124a.key", 0x0000, 0x2000, CRC(022a8a16) SHA1(4fd80105cb85ccba77cf1e76a21d6e245d5d2e7d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) ) ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) ) ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) ) ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END ROM_START( smgpjd ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-12432b.58", 0x00000, 0x20000, CRC(1c46c4de) SHA1(32711dfb8209317c6c2fc0fbb8f04b907123a4dc) ) ROM_LOAD16_BYTE( "bootleg_epr-12433b.63", 0x00001, 0x20000, CRC(ae8a4942) SHA1(53f52e6431353d611ac6a3520af053f955b79b37)) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) ) ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) ) ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) ) ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* // Super Monaco GP, Sega X-board // CPU: FD1094 (317-0124a) // ROM_START( smgpja ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12432a.58", 0x00000, 0x20000, CRC(22517672) SHA1(db9ac40e83e9786bc9dad70f62c2080d3df694ee) ) ROM_LOAD16_BYTE( "epr-12433a.63", 0x00001, 0x20000, CRC(a46b5d13) SHA1(3a7de5cb6f3e6d726f0ea886a87125dedc6f849f) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0124a.key", 0x0000, 0x2000, CRC(022a8a16) SHA1(4fd80105cb85ccba77cf1e76a21d6e245d5d2e7d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) ROM_LOAD16_BYTE( "epr-12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) ) ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) ) ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) ) ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..) ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // " ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // " ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // AB Cop (World), Sega X-board // CPU: FD1094 (317-0169b) // ROM_START( abcop ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13568b.ic58", 0x00000, 0x20000, CRC(f88db35b) SHA1(7d85c1194a2aa08427333d2ffc2a8d4f7e1beff0) ) ROM_LOAD16_BYTE( "epr-13556b.ic63", 0x00001, 0x20000, CRC(337bf32e) SHA1(dafb9d9b3baf79ca76355278e8a14294f186790a) ) ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) ) ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0169b.key", 0x0000, 0x2000, CRC(058da36e) SHA1(ab3f68a90725063c68fc5d0f8dbece1f8940dc7d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) ) ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) ) ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) ) ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) ) ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) ) ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) ) ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) ) ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) ) ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) ) ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) ) ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) ) ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) ) ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) ) ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) ) ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) ) ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) ) ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) ) ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) ) ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) ) ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) ) ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) ) ROM_END ROM_START( abcopd ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr13568b.ic58", 0x00000, 0x20000, CRC(3c367a01) SHA1(ddb37a399a67818c5b14c4fac1f25d0e660a7b0f) ) ROM_LOAD16_BYTE( "bootleg_epr13556b.ic63", 0x00001, 0x20000, CRC(1078246e) SHA1(3490f46c1f52d41f96fb449bdcee5fbec871aaca) ) ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) ) ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) ) ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) ) ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) ) ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) ) ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) ) ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) ) ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) ) ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) ) ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) ) ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) ) ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) ) ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) ) ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) ) ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) ) ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) ) ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) ) ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) ) ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) ) ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) ) ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) ) ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) ) ROM_END //************************************************************************************************************************* // AB Cop (Japan), Sega X-board // CPU: FD1094 (317-0169b) // ROM_START( abcopj ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13557b.ic58", 0x00000, 0x20000, CRC(554e106a) SHA1(3166957ded67c82d4710bdd20eb88006e14c6a3e) ) ROM_LOAD16_BYTE( "epr-13556b.ic63", 0x00001, 0x20000, CRC(337bf32e) SHA1(dafb9d9b3baf79ca76355278e8a14294f186790a) ) ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) ) ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0169b.key", 0x0000, 0x2000, CRC(058da36e) SHA1(ab3f68a90725063c68fc5d0f8dbece1f8940dc7d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) ) ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) ) ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) ) ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) ) ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) ) ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) ) ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) ) ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) ) ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) ) ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) ) ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) ) ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) ) ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) ) ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) ) ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) ) ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) ) ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) ) ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) ) ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) ) ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) ) ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) ) ROM_END ROM_START( abcopjd ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bootleg_epr-13557b.ic58", 0x00000, 0x20000, CRC(91f5d930) SHA1(8e3a4645b64b71cafa43bba3fd167dea494d7748) ) ROM_LOAD16_BYTE( "bootleg_epr-13556b.ic63", 0x00001, 0x20000, CRC(1078246e) SHA1(3490f46c1f52d41f96fb449bdcee5fbec871aaca) ) ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) ) ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) ) ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) ) ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) ) ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) ) ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) ) ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) ) ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) ) ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) ) ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) ) ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) ) ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) ) ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) ) ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) ) ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) ) ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) ) ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) ) ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) ) ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) ) ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) ) ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) ) ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) ) ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // GP Rider (World), Sega X-board // CPU: FD1094 (317-0163) // Custom Chip 315-5304 (IC 127) // IC BD Number: 834-7626-03 (roms are "MPR") / 834-7626-05 (roms are "EPR") // ROM_START( gpriders ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13409.ic58", 0x00000, 0x20000, CRC(9abb81b6) SHA1(f6308f3ec99ee66677e86f6a915e4dff8557d25f) ) ROM_LOAD16_BYTE( "epr-13408.ic63", 0x00001, 0x20000, CRC(8e410e97) SHA1(2021d738064e57d175b59ba053d9ee35ed4516c8) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0163.key", 0x0000, 0x2000, CRC(c1d4d207) SHA1(c35b0a49fb6a1e0e9a1c087f0ccd190ad5c2bb2c) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_END // Twin setup ROM_START( gprider ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13409.ic58", 0x00000, 0x20000, CRC(9abb81b6) SHA1(f6308f3ec99ee66677e86f6a915e4dff8557d25f) ) ROM_LOAD16_BYTE( "epr-13408.ic63", 0x00001, 0x20000, CRC(8e410e97) SHA1(2021d738064e57d175b59ba053d9ee35ed4516c8) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0163.key", 0x0000, 0x2000, CRC(c1d4d207) SHA1(c35b0a49fb6a1e0e9a1c087f0ccd190ad5c2bb2c) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_REGION( 0x80000, "subpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13409.ic58", 0x00000, 0x20000, CRC(9abb81b6) SHA1(f6308f3ec99ee66677e86f6a915e4dff8557d25f) ) ROM_LOAD16_BYTE( "epr-13408.ic63", 0x00001, 0x20000, CRC(8e410e97) SHA1(2021d738064e57d175b59ba053d9ee35ed4516c8) ) ROM_REGION( 0x2000, "subpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0163.key", 0x0000, 0x2000, CRC(c1d4d207) SHA1(c35b0a49fb6a1e0e9a1c087f0ccd190ad5c2bb2c) ) ROM_REGION( 0x80000, "subpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "subpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "subpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "subpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "subpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "subpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_END //************************************************************************************************************************* // GP Rider (US), Sega X-board // CPU: FD1094 (317-0162) // Custom Chip 315-5304 (IC 127) // IC BD Number: 834-7626-01 (roms are "MPR") / 834-7626-04 (roms are "EPR") // ROM_START( gpriderus ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) ) ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0162.key", 0x0000, 0x2000, CRC(8067de53) SHA1(e8cd1dfbad94856c6bd51569557667e72f0a5dd4) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_END // twin setup ROM_START( gprideru ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) ) ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0162.key", 0x0000, 0x2000, CRC(8067de53) SHA1(e8cd1dfbad94856c6bd51569557667e72f0a5dd4) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_REGION( 0x80000, "subpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) ) ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) ) ROM_REGION( 0x2000, "subpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0162.key", 0x0000, 0x2000, CRC(8067de53) SHA1(e8cd1dfbad94856c6bd51569557667e72f0a5dd4) ) ROM_REGION( 0x80000, "subpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "subpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "subpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "subpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "subpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "subpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_END //************************************************************************************************************************* // GP Rider (Japan), Sega X-board // CPU: FD1094 (317-0161) // Custom Chip 315-5304 (IC 127) // IC BD Number: 834-7626-01 (roms are "MPR") / 834-7626-04 (roms are "EPR") // ROM_START( gpriderjs ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13387.ic58", 0x00000, 0x20000, CRC(a1e8b2c5) SHA1(22b70a9074263af808bb9dffee29cbcff7e304e3) ) ROM_LOAD16_BYTE( "epr-13386.ic63", 0x00001, 0x20000, CRC(d8be9e66) SHA1(d81c03b08fd6b971554b94e0adac131a1dcf3248) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0161.key", 0x0000, 0x2000, CRC(e38ddc16) SHA1(d1f7f261320cbc605b4f7e5a9c28f49af5471d87) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_END // twin setup ROM_START( gpriderj ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13387.ic58", 0x00000, 0x20000, CRC(a1e8b2c5) SHA1(22b70a9074263af808bb9dffee29cbcff7e304e3) ) ROM_LOAD16_BYTE( "epr-13386.ic63", 0x00001, 0x20000, CRC(d8be9e66) SHA1(d81c03b08fd6b971554b94e0adac131a1dcf3248) ) ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0161.key", 0x0000, 0x2000, CRC(e38ddc16) SHA1(d1f7f261320cbc605b4f7e5a9c28f49af5471d87) ) ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_REGION( 0x80000, "subpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13387.ic58", 0x00000, 0x20000, CRC(a1e8b2c5) SHA1(22b70a9074263af808bb9dffee29cbcff7e304e3) ) ROM_LOAD16_BYTE( "epr-13386.ic63", 0x00001, 0x20000, CRC(d8be9e66) SHA1(d81c03b08fd6b971554b94e0adac131a1dcf3248) ) ROM_REGION( 0x2000, "subpcb:maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0161.key", 0x0000, 0x2000, CRC(e38ddc16) SHA1(d1f7f261320cbc605b4f7e5a9c28f49af5471d87) ) ROM_REGION( 0x80000, "subpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) ) ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) ) ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) ) ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) ) ROM_REGION( 0x30000, "subpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) ) ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) ) ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) ) ROM_REGION32_LE( 0x200000, "subpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) ) ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) ) ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) ) ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) ) ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) ) ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) ) ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) ) ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) ) ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) ) ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) ) ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) ) ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) ) ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) ) ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) ) ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) ) ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) ) ROM_REGION( 0x10000, "subpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "subpcb:soundcpu", 0 ) // sound CPU ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) ) ROM_REGION( 0x80000, "subpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) ) ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) ) ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) ) ROM_END //************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Royal Ascot - should be X-Board, or closely related, although it's a main display / terminal setup, // and we only have the ROMs for one of those parts.. // ROM_START( rascot ) ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13965a.ic58", 0x00000, 0x20000, CRC(7eacdfb3) SHA1(fad23352d9c5e266ad9f7fe3ccbd29b5b912b90b) ) ROM_LOAD16_BYTE( "epr-13694a.ic63", 0x00001, 0x20000, CRC(15b86498) SHA1(ccb57063ca53347b5f771b0d7ceaeb9cd50d246a) ) // 13964a? ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code ROM_LOAD16_BYTE( "epr-13967.ic20", 0x00000, 0x20000, CRC(3b92e2b8) SHA1(5d456d7d6fa540709facda1fd8813707ebfd99d8) ) ROM_LOAD16_BYTE( "epr-13966.ic29", 0x00001, 0x20000, CRC(eaa644e1) SHA1(b9cc171523995f5120ea7b9748af2f8de697b933) ) ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles ROM_LOAD( "epr-13961", 0x00000, 0x10000, CRC(68038629) SHA1(fbe8605840331096c5156d695772e5f36b2e131a) ) ROM_LOAD( "epr-13962", 0x10000, 0x10000, CRC(7d7605bc) SHA1(20d3a7116807db7c831e285233d8c67317980e4a) ) ROM_LOAD( "epr-13963", 0x20000, 0x10000, CRC(f3376b65) SHA1(36b9292518a112409d03b97ea048b7ab22734841) ) ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites ROM_LOAD32_BYTE( "epr-13960", 0x000000, 0x20000, CRC(b974128d) SHA1(14450615b3a10b1de6d098a282f80f80c98c34b8) ) ROM_LOAD32_BYTE( "epr-13959", 0x000001, 0x20000, CRC(db245b22) SHA1(301b7caea7a3b42ab1ab21894ad61b8b14ef1e7c) ) ROM_LOAD32_BYTE( "epr-13958", 0x000002, 0x20000, CRC(7803a027) SHA1(ff659da334e4440a6de9be43dde9dfa21dae5f14) ) ROM_LOAD32_BYTE( "epr-13957", 0x000003, 0x20000, CRC(6d50fb54) SHA1(d21462c30a5555980b964930ddef4dc1963e1d8e) ) ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx // none?? ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU // is this really a sound rom, or a terminal / link rom? accesses unexpected addresses ROM_LOAD( "epr-14221a", 0x00000, 0x10000, CRC(0d429ac4) SHA1(9cd4c7e858874f372eb3e409ba37964f1ebf07d5) ) ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data // none?? ROM_END //************************************************************************** // CONFIGURATION //************************************************************************** //------------------------------------------------- // init_* - game-specific initialization //------------------------------------------------- void segaxbd_state::install_aburner2(void) { m_road_priority = 0; m_iochip_custom_io_r[0][0] = ioread_delegate(FUNC(segaxbd_state::aburner2_iochip0_motor_r), this); m_iochip_custom_io_w[0][1] = iowrite_delegate(FUNC(segaxbd_state::aburner2_iochip0_motor_w), this); } DRIVER_INIT_MEMBER(segaxbd_new_state,aburner2) { m_mainpcb->install_aburner2(); } void segaxbd_state::install_lastsurv(void) { m_iochip_custom_io_r[1][1] = ioread_delegate(FUNC(segaxbd_state::lastsurv_iochip1_port_r), this); m_iochip_custom_io_w[0][3] = iowrite_delegate(FUNC(segaxbd_state::lastsurv_iochip0_muxer_w), this); } DRIVER_INIT_MEMBER(segaxbd_new_state,lastsurv) { m_mainpcb->install_lastsurv(); } void segaxbd_state::install_loffire(void) { m_adc_reverse[1] = m_adc_reverse[3] = true; // install sync hack on core shared memory m_maincpu->space(AS_PROGRAM).install_write_handler(0x29c000, 0x29c011, write16_delegate(FUNC(segaxbd_state::loffire_sync0_w), this)); m_loffire_sync = m_subram0; } DRIVER_INIT_MEMBER(segaxbd_new_state,loffire) { m_mainpcb->install_loffire(); } void segaxbd_state::install_smgp(void) { m_iochip_custom_io_r[0][0] = ioread_delegate(FUNC(segaxbd_state::smgp_iochip0_motor_r), this); m_iochip_custom_io_w[0][1] = iowrite_delegate(FUNC(segaxbd_state::smgp_iochip0_motor_w), this); // map /EXCS space m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2f0000, 0x2f3fff, read16_delegate(FUNC(segaxbd_state::smgp_excs_r), this), write16_delegate(FUNC(segaxbd_state::smgp_excs_w), this)); } DRIVER_INIT_MEMBER(segaxbd_new_state,smgp) { m_mainpcb->install_smgp(); } DRIVER_INIT_MEMBER(segaxbd_new_state,rascot) { // patch out bootup link test UINT16 *rom = reinterpret_cast<UINT16 *>(memregion("mainpcb:subcpu")->base()); rom[0xb78/2] = 0x601e; // subrom checksum test rom[0x57e/2] = 0x4e71; rom[0x5d0/2] = 0x6008; rom[0x606/2] = 0x4e71; // map /EXCS space m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0f0000, 0x0f3fff, read16_delegate(FUNC(segaxbd_state::rascot_excs_r), (segaxbd_state*)m_mainpcb), write16_delegate(FUNC(segaxbd_state::rascot_excs_w), (segaxbd_state*)m_mainpcb)); } void segaxbd_state::install_gprider(void) { m_gprider_hack = true; } DRIVER_INIT_MEMBER(segaxbd_new_state,gprider) { m_mainpcb->install_gprider(); } DRIVER_INIT_MEMBER(segaxbd_new_state_double,gprider_double) { m_mainpcb->install_gprider(); m_subpcb->install_gprider(); m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2F0000, 0x2F003f, read16_delegate(FUNC(segaxbd_new_state_double::shareram1_r), this), write16_delegate(FUNC(segaxbd_new_state_double::shareram1_w), this)); m_subpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2F0000, 0x2F003f, read16_delegate(FUNC(segaxbd_new_state_double::shareram2_r), this), write16_delegate(FUNC(segaxbd_new_state_double::shareram2_w), this)); } //************************************************************************** // GAME DRIVERS //************************************************************************** // YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS GAME( 1987, aburner2, 0, sega_xboard, aburner2, segaxbd_new_state, aburner2, ROT0, "Sega", "After Burner II", 0 ) GAME( 1987, aburner2g,aburner2, sega_xboard, aburner2, segaxbd_new_state, aburner2, ROT0, "Sega", "After Burner II (German)", 0 ) GAME( 1987, aburner, aburner2, sega_xboard, aburner, segaxbd_new_state, aburner2, ROT0, "Sega", "After Burner", 0 ) GAME( 1987, thndrbld, 0, sega_xboard_fd1094, thndrbld, driver_device, 0, ROT0, "Sega", "Thunder Blade (upright) (FD1094 317-0056)", 0 ) GAME( 1987, thndrbld1,thndrbld, sega_xboard, thndrbd1, driver_device, 0, ROT0, "Sega", "Thunder Blade (deluxe/standing) (unprotected)", 0 ) GAME( 1989, lastsurv, 0, sega_lastsurv_fd1094,lastsurv, segaxbd_new_state, lastsurv, ROT0, "Sega", "Last Survivor (Japan) (FD1094 317-0083)", 0 ) GAME( 1989, loffire, 0, sega_xboard_fd1094, loffire, segaxbd_new_state, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (World) (FD1094 317-0136)", 0 ) GAME( 1989, loffireu, loffire, sega_xboard_fd1094, loffire, segaxbd_new_state, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (US) (FD1094 317-0135)", 0 ) GAME( 1989, loffirej, loffire, sega_xboard_fd1094, loffire, segaxbd_new_state, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (Japan) (FD1094 317-0134)", 0 ) GAME( 1989, rachero, 0, sega_xboard_fd1094, rachero, driver_device, 0, ROT0, "Sega", "Racing Hero (FD1094 317-0144)", 0 ) GAME( 1989, smgp, 0, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (World, Rev B) (FD1094 317-0126a)", 0 ) GAME( 1989, smgp6, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (World, Rev A) (FD1094 317-0126a)", 0 ) GAME( 1989, smgp5, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (World) (FD1094 317-0126)", 0 ) GAME( 1989, smgpu, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (US, Rev C) (FD1094 317-0125a)", 0 ) GAME( 1989, smgpu1, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (US, Rev B) (FD1094 317-0125a)", 0 ) GAME( 1989, smgpu2, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (US, Rev A) (FD1094 317-0125a)", 0 ) GAME( 1989, smgpj, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (Japan, Rev B) (FD1094 317-0124a)", 0 ) GAME( 1989, smgpja, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (Japan, Rev A) (FD1094 317-0124a)", 0 ) GAME( 1990, abcop, 0, sega_xboard_fd1094, abcop, driver_device, 0, ROT0, "Sega", "A.B. Cop (World) (FD1094 317-0169b)", 0 ) GAME( 1990, abcopj, abcop, sega_xboard_fd1094, abcop, driver_device, 0, ROT0, "Sega", "A.B. Cop (Japan) (FD1094 317-0169b)", 0 ) // wasn't officially available as a single PCB setup, but runs anyway albeit with messages suggesting you can compete against a rival that doesn't exist? GAME( 1990, gpriders, gprider, sega_xboard_fd1094, gprider, segaxbd_new_state, gprider, ROT0, "Sega", "GP Rider (World, FD1094 317-0163)", 0 ) GAME( 1990, gpriderus,gprider, sega_xboard_fd1094, gprider, segaxbd_new_state, gprider, ROT0, "Sega", "GP Rider (US, FD1094 317-0162)", 0 ) GAME( 1990, gpriderjs,gprider, sega_xboard_fd1094, gprider, segaxbd_new_state, gprider, ROT0, "Sega", "GP Rider (Japan, FD1094 317-0161)", 0 ) // multi X-Board (2 stacks directly connected, shared RAM on bridge PCB - not networked) GAME( 1990, gprider, 0, sega_xboard_fd1094_double, gprider_double, segaxbd_new_state_double, gprider_double, ROT0, "Sega", "GP Rider (World, FD1094 317-0163) (Twin setup)", 0 ) GAME( 1990, gprideru,gprider, sega_xboard_fd1094_double, gprider_double, segaxbd_new_state_double, gprider_double, ROT0, "Sega", "GP Rider (US, FD1094 317-0162) (Twin setup)", 0 ) GAME( 1990, gpriderj,gprider, sega_xboard_fd1094_double, gprider_double, segaxbd_new_state_double, gprider_double, ROT0, "Sega", "GP Rider (Japan, FD1094 317-0161) (Twin setup)", 0 ) // X-Board + other boards? GAME( 1991, rascot, 0, sega_rascot, rascot, segaxbd_new_state, rascot, ROT0, "Sega", "Royal Ascot (Japan, terminal?)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // decrypted bootlegs GAME( 1987, thndrbldd, thndrbld,sega_xboard, thndrbld, driver_device, 0, ROT0, "bootleg", "Thunder Blade (upright) (bootleg of FD1094 317-0056 set)", 0 ) GAME( 1989, racherod, rachero, sega_xboard, rachero, driver_device, 0, ROT0, "bootleg", "Racing Hero (bootleg of FD1094 317-0144 set)", 0 ) GAME( 1989, smgpd, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (World, Rev B) (bootleg of FD1094 317-0126a set)", 0 ) GAME( 1989, smgp6d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (World, Rev A) (bootleg of FD1094 317-0126a set)", 0 ) GAME( 1989, smgp5d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (World) (bootleg of FD1094 317-0126 set)", 0 ) GAME( 1989, smgpud, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (US, Rev C) (bootleg of FD1094 317-0125a set)", 0 ) GAME( 1989, smgpu1d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (US, Rev B) (bootleg of FD1094 317-0125a set)", 0 ) GAME( 1989, smgpu2d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (US, Rev A) (bootleg of FD1094 317-0125a set)", 0 ) GAME( 1989, smgpjd, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (Japan, Rev B) (bootleg of FD1094 317-0124a set)", 0 ) GAME( 1989, lastsurvd,lastsurv, sega_lastsurv,lastsurv, segaxbd_new_state, lastsurv, ROT0, "bootleg", "Last Survivor (Japan) (bootleg of FD1094 317-0083 set)", 0 ) GAME( 1990, abcopd, abcop, sega_xboard, abcop, driver_device, 0, ROT0, "bootleg", "A.B. Cop (World) (bootleg of FD1094 317-0169b set)", 0 ) GAME( 1990, abcopjd, abcop, sega_xboard, abcop, driver_device, 0, ROT0, "bootleg", "A.B. Cop (Japan) (bootleg of FD1094 317-0169b set)", 0 ) GAME( 1989, loffired, loffire, sega_xboard, loffire, segaxbd_new_state, loffire, ROT0, "bootleg", "Line of Fire / Bakudan Yarou (World) (bootleg of FD1094 317-0136 set)", 0 ) GAME( 1989, loffireud, loffire, sega_xboard, loffire, segaxbd_new_state, loffire, ROT0, "bootleg", "Line of Fire / Bakudan Yarou (US) (bootleg of FD1094 317-0135 set)", 0 ) GAME( 1989, loffirejd, loffire, sega_xboard, loffire, segaxbd_new_state, loffire, ROT0, "bootleg", "Line of Fire / Bakudan Yarou (Japan) (bootleg of FD1094 317-0134 set)", 0 )<|fim▁end|>
<|file_name|>euler3.py<|end_file_name|><|fim▁begin|>import time start = time.time() def prime_factors(n): l = [] i = 2 while n != 1: if n % i == 0: l.append(i) while n % i == 0: n = n // i i += 1 return l print(prime_factors(600851475143)[-1]) elapsed = time.time() - start<|fim▁hole|><|fim▁end|>
print("time elapsed:", elapsed, "seconds")
<|file_name|>sv.extra.js<|end_file_name|><|fim▁begin|>// Validation errors messages for Parsley // Load this after Parsley Parsley.addMessages('sv', {<|fim▁hole|><|fim▁end|>
dateiso: "Ange ett giltigt datum (ÅÅÅÅ-MM-DD)." });
<|file_name|>input.webcomponent.js<|end_file_name|><|fim▁begin|>module.exports = MnInputCustomElement() function MnInputCustomElement() { const supportsCustomElements = 'customElements' in window if (!supportsCustomElements) {<|fim▁hole|> window.customElements.define('mn-input', require('./input.class.js')) } return window.customElements.get('mn-input') }<|fim▁end|>
require('@webcomponents/custom-elements') } if (!window.customElements.get('mn-input')) {
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>""" This component provides HA sensor support for Ring Door Bell/Chimes. For more details about this platform, please refer to the documentation at<|fim▁hole|>import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity from homeassistant.helpers.icon import icon_for_battery_level from . import ATTRIBUTION, DATA_RING, DEFAULT_ENTITY_NAMESPACE DEPENDENCIES = ['ring'] _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(seconds=30) # Sensor types: Name, category, units, icon, kind SENSOR_TYPES = { 'battery': [ 'Battery', ['doorbell', 'stickup_cams'], '%', 'battery-50', None], 'last_activity': [ 'Last Activity', ['doorbell', 'stickup_cams'], None, 'history', None], 'last_ding': [ 'Last Ding', ['doorbell'], None, 'history', 'ding'], 'last_motion': [ 'Last Motion', ['doorbell', 'stickup_cams'], None, 'history', 'motion'], 'volume': [ 'Volume', ['chime', 'doorbell', 'stickup_cams'], None, 'bell-ring', None], 'wifi_signal_category': [ 'WiFi Signal Category', ['chime', 'doorbell', 'stickup_cams'], None, 'wifi', None], 'wifi_signal_strength': [ 'WiFi Signal Strength', ['chime', 'doorbell', 'stickup_cams'], 'dBm', 'wifi', None], } PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_ENTITY_NAMESPACE, default=DEFAULT_ENTITY_NAMESPACE): cv.string, vol.Required(CONF_MONITORED_CONDITIONS, default=list(SENSOR_TYPES)): vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]), }) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up a sensor for a Ring device.""" ring = hass.data[DATA_RING] sensors = [] for device in ring.chimes: # ring.chimes is doing I/O for sensor_type in config[CONF_MONITORED_CONDITIONS]: if 'chime' in SENSOR_TYPES[sensor_type][1]: sensors.append(RingSensor(hass, device, sensor_type)) for device in ring.doorbells: # ring.doorbells is doing I/O for sensor_type in config[CONF_MONITORED_CONDITIONS]: if 'doorbell' in SENSOR_TYPES[sensor_type][1]: sensors.append(RingSensor(hass, device, sensor_type)) for device in ring.stickup_cams: # ring.stickup_cams is doing I/O for sensor_type in config[CONF_MONITORED_CONDITIONS]: if 'stickup_cams' in SENSOR_TYPES[sensor_type][1]: sensors.append(RingSensor(hass, device, sensor_type)) add_entities(sensors, True) return True class RingSensor(Entity): """A sensor implementation for Ring device.""" def __init__(self, hass, data, sensor_type): """Initialize a sensor for Ring device.""" super(RingSensor, self).__init__() self._sensor_type = sensor_type self._data = data self._extra = None self._icon = 'mdi:{}'.format(SENSOR_TYPES.get(self._sensor_type)[3]) self._kind = SENSOR_TYPES.get(self._sensor_type)[4] self._name = "{0} {1}".format( self._data.name, SENSOR_TYPES.get(self._sensor_type)[0]) self._state = None self._tz = str(hass.config.time_zone) self._unique_id = '{}-{}'.format(self._data.id, self._sensor_type) @property def name(self): """Return the name of the sensor.""" return self._name @property def state(self): """Return the state of the sensor.""" return self._state @property def unique_id(self): """Return a unique ID.""" return self._unique_id @property def device_state_attributes(self): """Return the state attributes.""" attrs = {} attrs[ATTR_ATTRIBUTION] = ATTRIBUTION attrs['device_id'] = self._data.id attrs['firmware'] = self._data.firmware attrs['kind'] = self._data.kind attrs['timezone'] = self._data.timezone attrs['type'] = self._data.family attrs['wifi_name'] = self._data.wifi_name if self._extra and self._sensor_type.startswith('last_'): attrs['created_at'] = self._extra['created_at'] attrs['answered'] = self._extra['answered'] attrs['recording_status'] = self._extra['recording']['status'] attrs['category'] = self._extra['kind'] return attrs @property def icon(self): """Icon to use in the frontend, if any.""" if self._sensor_type == 'battery' and self._state is not None: return icon_for_battery_level(battery_level=int(self._state), charging=False) return self._icon @property def unit_of_measurement(self): """Return the units of measurement.""" return SENSOR_TYPES.get(self._sensor_type)[2] def update(self): """Get the latest data and updates the state.""" _LOGGER.debug("Pulling data from %s sensor", self._name) self._data.update() if self._sensor_type == 'volume': self._state = self._data.volume if self._sensor_type == 'battery': self._state = self._data.battery_life if self._sensor_type.startswith('last_'): history = self._data.history(limit=5, timezone=self._tz, kind=self._kind, enforce_limit=True) if history: self._extra = history[0] created_at = self._extra['created_at'] self._state = '{0:0>2}:{1:0>2}'.format( created_at.hour, created_at.minute) if self._sensor_type == 'wifi_signal_category': self._state = self._data.wifi_signal_category if self._sensor_type == 'wifi_signal_strength': self._state = self._data.wifi_signal_strength<|fim▁end|>
https://home-assistant.io/components/sensor.ring/ """ from datetime import timedelta
<|file_name|>SafePaste.js<|end_file_name|><|fim▁begin|><|fim▁hole|>//>>built define("dojox/editor/plugins/nls/zh-tw/SafePaste",({"instructions":"已停用直接貼上。請使用標準瀏覽器鍵盤或功能表貼上控制項,在這個對話框中貼上內容。當您滿意要插入的內容之後,請按貼上按鈕。若要中斷插入內容,請按取消按鈕。"}));<|fim▁end|>
<|file_name|>Quote.cpp<|end_file_name|><|fim▁begin|>/* Copyright (C) 2005 Kimmo Pekkola 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 2 of the License, or (at your option) 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <windows.h> #include <string> #include <vector> #include <time.h> #include <shlwapi.h> #include <random> #include "../API/RainmeterAPI.h" #include "../../Common/StringUtil.h" #define BUFFER_SIZE 4096 template <typename T> T GetRandomNumber(T size) { static std::mt19937 s_Engine((unsigned)time(nullptr)); const std::uniform_int_distribution<T> distribution(0, size); return distribution(s_Engine); } struct MeasureData { std::wstring pathname; std::wstring separator; std::vector<std::wstring> files; std::wstring value; }; void ScanFolder(std::vector<std::wstring>& files, std::vector<std::wstring>& filters, bool bSubfolders, const std::wstring& path) { // Get folder listing WIN32_FIND_DATA fileData; // Data structure describes the file found HANDLE hSearch; // Search handle returned by FindFirstFile std::wstring searchPath = path + L"*"; hSearch = FindFirstFile(searchPath.c_str(), &fileData); if (hSearch == INVALID_HANDLE_VALUE) return; // No more files found do { if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (bSubfolders && wcscmp(fileData.cFileName, L".") != 0 && wcscmp(fileData.cFileName, L"..") != 0) { ScanFolder(files, filters, bSubfolders, path + fileData.cFileName + L"\\"); } } else { if (!filters.empty()) { for (size_t i = 0; i < filters.size(); ++i) { if (!filters[i].empty() && PathMatchSpec(fileData.cFileName, filters[i].c_str())) { files.push_back(path + fileData.cFileName); break; } } } else { files.push_back(path + fileData.cFileName); } } } while (FindNextFile(hSearch, &fileData)); FindClose(hSearch); } PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; } PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) { MeasureData* measure = (MeasureData*)data; measure->pathname = RmReadPath(rm, L"PathName", L""); if (PathIsDirectory(measure->pathname.c_str())) { std::vector<std::wstring> fileFilters; LPCWSTR filter = RmReadString(rm, L"FileFilter", L""); if (*filter) { std::wstring ext = filter; size_t start = 0; size_t pos = ext.find(L';'); while (pos != std::wstring::npos) { fileFilters.push_back(ext.substr(start, pos - start)); start = pos + 1; pos = ext.find(L';', pos + 1); } fileFilters.push_back(ext.substr(start)); } if (measure->pathname[measure->pathname.size() - 1] != L'\\') { measure->pathname += L"\\"; } // Scan files measure->files.clear(); bool bSubfolders = RmReadInt(rm, L"Subfolders", 1) == 1; ScanFolder(measure->files, fileFilters, bSubfolders, measure->pathname); } else { measure->separator = RmReadString(rm, L"Separator", L"\n"); <|fim▁hole|> PLUGIN_EXPORT double Update(void* data) { MeasureData* measure = (MeasureData*)data; if (measure->files.empty()) { BYTE buffer[BUFFER_SIZE + 2]; buffer[BUFFER_SIZE] = 0; // Read the file FILE* file = _wfopen(measure->pathname.c_str(), L"r"); if (file) { // Check if the file is unicode or ascii fread(buffer, sizeof(WCHAR), 1, file); fseek(file, 0, SEEK_END); long size = ftell(file); if (size > 0) { // Go to a random place long pos = GetRandomNumber(size); fseek(file, (pos / 2) * 2, SEEK_SET); measure->value.clear(); if (0xFEFF == *(WCHAR*)buffer) { // It's unicode WCHAR* wBuffer = (WCHAR*)buffer; // Read until we find the first separator WCHAR* sepPos1 = nullptr; WCHAR* sepPos2 = nullptr; do { size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file); buffer[len] = 0; buffer[len + 1] = 0; sepPos1 = wcsstr(wBuffer, measure->separator.c_str()); if (sepPos1 == nullptr) { // The separator wasn't found if (feof(file)) { // End of file reached -> read from start fseek(file, 2, SEEK_SET); len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file); buffer[len] = 0; buffer[len + 1] = 0; sepPos1 = wBuffer; } // else continue reading } else { sepPos1 += measure->separator.size(); } } while (sepPos1 == nullptr); // Find the second separator do { sepPos2 = wcsstr(sepPos1, measure->separator.c_str()); if (sepPos2 == nullptr) { // The separator wasn't found if (feof(file)) { // End of file reached -> read the rest measure->value += sepPos1; break; } else { measure->value += sepPos1; // else continue reading size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file); buffer[len] = 0; buffer[len + 1] = 0; sepPos1 = wBuffer; } } else { if (sepPos2) { *sepPos2 = 0; } // Read until we find the second separator measure->value += sepPos1; } } while (sepPos2 == nullptr); } else { // It's ascii char* aBuffer = (char*)buffer; const std::string separator = StringUtil::Narrow(measure->separator); const char* separatorSz = separator.c_str(); // Read until we find the first separator char* sepPos1 = nullptr; char* sepPos2 = nullptr; do { size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file); aBuffer[len] = 0; sepPos1 = strstr(aBuffer, separatorSz); if (sepPos1 == nullptr) { // The separator wasn't found if (feof(file)) { // End of file reached -> read from start fseek(file, 0, SEEK_SET); len = fread(buffer, sizeof(char), BUFFER_SIZE, file); aBuffer[len] = 0; sepPos1 = aBuffer; } // else continue reading } else { sepPos1 += separator.size(); } } while (sepPos1 == nullptr); // Find the second separator do { sepPos2 = strstr(sepPos1, separatorSz); if (sepPos2 == nullptr) { // The separator wasn't found if (feof(file)) { // End of file reached -> read the rest measure->value += StringUtil::Widen(sepPos1); break; } else { measure->value += StringUtil::Widen(sepPos1); // else continue reading size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file); aBuffer[len] = 0; sepPos1 = aBuffer; } } else { if (sepPos2) { *sepPos2 = 0; } // Read until we find the second separator measure->value += StringUtil::Widen(sepPos1); } } while (sepPos2 == nullptr); } } fclose(file); } } else { // Select the filename measure->value = measure->files[GetRandomNumber(measure->files.size() - 1)]; } return 0; } PLUGIN_EXPORT LPCWSTR GetString(void* data) { MeasureData* measure = (MeasureData*)data; return measure->value.c_str(); } PLUGIN_EXPORT void Finalize(void* data) { MeasureData* measure = (MeasureData*)data; delete measure; }<|fim▁end|>
} }
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). <|fim▁hole|><|fim▁end|>
from . import test_purchase_delivery
<|file_name|>codeMarble_py3des.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from py3Des.pyDes import triple_des, ECB, PAD_PKCS5 class TripleDES: __triple_des = None @staticmethod def init(): TripleDES.__triple_des = triple_des('1234567812345678', mode=ECB, IV = '\0\0\0\0\0\0\0\0', pad=None, padmode = PAD_PKCS5) @staticmethod<|fim▁hole|> @staticmethod def decrypt(data): return TripleDES.__triple_des.decrypt(data)<|fim▁end|>
def encrypt(data): return TripleDES.__triple_des.encrypt(data)
<|file_name|>telnetserver.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Bastian Kleineidam # # 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 2 of the License, or # (at your option) 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, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """ Define http test support classes for LinkChecker tests. """ import time import threading import telnetlib import miniboa from . import LinkCheckTest TIMEOUT = 5 class TelnetServerTest(LinkCheckTest): """Start/stop a Telnet server that can be used for testing.""" def __init__(self, methodName="runTest"): """Init test class and store default ftp server port.""" super().__init__(methodName=methodName) self.host = "localhost" self.port = None self.stop_event = threading.Event() self.server_thread = None def get_url(self, user=None, password=None): if user is not None: if password is not None: netloc = "%s:%s@%s" % (user, password, self.host) else: netloc = "%s@%s" % (user, self.host) else: netloc = self.host return "telnet://%s:%d" % (netloc, self.port) def setUp(self): """Start a new Telnet server in a new thread.""" self.port, self.server_thread = start_server(self.host, 0, self.stop_event) self.assertFalse(self.port is None) def tearDown(self): """Send QUIT request to telnet server.""" self.stop_event.set() if self.server_thread is not None: self.server_thread.join(10) assert not self.server_thread.is_alive() def start_server(host, port, stop_event): # Instantiate Telnet server class and listen to host:port<|fim▁hole|> clients = [] def on_connect(client): clients.append(client) client.send("Telnet test server\nlogin: ") server = miniboa.TelnetServer(port=port, address=host, on_connect=on_connect) port = server.server_socket.getsockname()[1] t = threading.Thread(None, serve_forever, args=(server, clients, stop_event)) t.start() # wait for server to start up tries = 0 while tries < 5: tries += 1 try: client = telnetlib.Telnet(timeout=TIMEOUT) client.open(host, port) client.write(b"exit\n") break except Exception: time.sleep(0.5) return port, t def serve_forever(server, clients, stop_event): """Run poll loop for server.""" while True: if stop_event.is_set(): return server.poll() for client in clients: if client.active and client.cmd_ready: handle_cmd(client) def handle_cmd(client): """Handle telnet clients.""" msg = client.get_command().lower() if msg == "exit": client.active = False else: client.send("Password: ")<|fim▁end|>
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010-2011 OpenStack LLC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License.<|fim▁hole|> import gettext gettext.install('glance', unicode=1)<|fim▁end|>
<|file_name|>directive-template.js<|end_file_name|><|fim▁begin|>'use strict'; require('angular/angular'); angular.module('<%= name %>Module', []) .directive('<%= name %>', [ function() { return { restrict: 'E', replace: true,<|fim▁hole|> scope.directiveTitle = 'dummy'; } }; } ]);<|fim▁end|>
templateUrl: 'src/<%= name %>/<%= name %>.tpl.html', scope: {}, link: function(scope, element, attrs) {
<|file_name|>hfs_alt.py<|end_file_name|><|fim▁begin|>''' Copyright 2011 Jean-Baptiste B'edrune, Jean Sigwald Using New BSD License: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' # # This code has since been edited to improve HFS parsing, add lzvn/lzfse support # and is now a part of the mac_apt framework # import os import mmap import sys import struct import tempfile import zlib import pytsk3 import logging from plugins.helpers.common import CommonFunctions from plugins.helpers.btree import AttributesTree, CatalogTree, ExtentsOverflowTree from plugins.helpers.structs import * log = logging.getLogger('MAIN.HELPERS.HFS_ALT') lzfse_capable = False try: import liblzfse lzfse_capable = True except ImportError: print("liblzfse not found. Won't decompress lzfse/lzvn streams") def write_file(filename,data): f = open(filename, "wb") f.write(data) f.close() def lzvn_decompress(compressed_stream, compressed_size, uncompressed_size): #TODO: Move to a class! '''Adds Prefix and Postfix bytes as required by decompressor, then decompresses and returns uncompressed bytes buffer ''' header = b'bvxn' + struct.pack('<I', uncompressed_size) + struct.pack('<I', compressed_size) footer = b'bvx$' return liblzfse.decompress(header + compressed_stream + footer) class HFSFile(object): def __init__(self, volume, hfsplusfork, fileID, deleted=False): self.volume = volume self.blockSize = volume.blockSize self.fileID = fileID self.totalBlocks = hfsplusfork.totalBlocks self.logicalSize = hfsplusfork.logicalSize self.extents = [] self.deleted = deleted b = 0 for extent in hfsplusfork.HFSPlusExtentDescriptor: self.extents.append(extent) b += extent.blockCount while b != hfsplusfork.totalBlocks: #log.debug("extents overflow {}".format(b)) k,v = volume.getExtentsOverflowForFile(fileID, b) if not v: log.debug("extents overflow missing, startblock={}".format(b)) break for extent in v: self.extents.append(extent) b += extent.blockCount def copyOutFile(self, outputfile, truncate=True): f = open(outputfile, "wb") for i in range(self.totalBlocks): f.write(self.readBlock(i)) if truncate: f.truncate(self.logicalSize) f.close() '''def readAllBuffer(self, truncate=True): r = b"" for i in range(self.totalBlocks): r += self.readBlock(i) if truncate: r = r[:self.logicalSize] return r ''' def readAllBuffer(self, truncate=True, output_file=None): '''Write to output_file if valid, else return a buffer of data. Warning: If file size > 200 MiB, b'' is returned, file data is only written to output_file. ''' r = b"" bs = self.volume.blockSize blocks_max = 52428800 // bs # 50MB for extent in self.extents: if extent.blockCount == 0: continue #if not self.deleted and self.fileID != kHFSAllocationFileID and not self.volume.isBlockInUse(lba): # log.debug("FAIL, block "0x{:x}" not marked as used".format(n)) if extent.blockCount > blocks_max: counter = blocks_max remaining_blocks = extent.blockCount start_address = extent.startBlock * bs while remaining_blocks > 0: num_blocks_to_read = min(blocks_max, remaining_blocks) size = num_blocks_to_read * bs data = self.volume.read(start_address, size) if output_file: output_file.write(data) elif self.logicalSize < 209715200: # 200MiB r += data remaining_blocks -= num_blocks_to_read start_address += size else: data = self.volume.read(extent.startBlock * bs, bs * extent.blockCount) if output_file: output_file.write(data) elif self.logicalSize < 209715200: # 200MiB r += data if truncate: if output_file: output_file.truncate(self.logicalSize) elif self.logicalSize < 209715200: # 200MiB r = r[:self.logicalSize] return r def processBlock(self, block, lba): return block def readBlock(self, n): bs = self.volume.blockSize if n*bs > self.logicalSize: raise ValueError("BLOCK OUT OF BOUNDS") bc = 0 for extent in self.extents: bc += extent.blockCount if n < bc: lba = extent.startBlock+(n-(bc-extent.blockCount)) if not self.deleted and self.fileID != kHFSAllocationFileID and not self.volume.isBlockInUse(lba): raise ValueError("FAIL, block %x not marked as used" % n) return self.processBlock(self.volume.read(lba*bs, bs), lba) return b"" class HFSCompressedResourceFork(HFSFile): def __init__(self, volume, hfsplusfork, fileID, compression_type, uncompressed_size): super(HFSCompressedResourceFork,self).__init__(volume, hfsplusfork, fileID) block0 = self.readBlock(0) self.compression_type = compression_type self.uncompressed_size = uncompressed_size if compression_type in [8, 12]: # 8 is lzvn, 12 is lzfse #only tested for 8 self.header = HFSPlusCmpfLZVNRsrcHead.parse(block0) #print(self.header) else: self.header = HFSPlusCmpfRsrcHead.parse(block0) #print(self.header) self.blocks = HFSPlusCmpfRsrcBlockHead.parse(block0[self.header.headerSize:]) log.debug("HFSCompressedResourceFork numBlocks:{}".format(self.blocks.numBlocks)) #HAX, readblock not implemented def readAllBuffer(self, truncate=True, output_file=None): '''Warning: If output size > 200 MiB, b'' is returned, file data is only written to output_file.''' if self.compression_type in [7, 8, 11, 12] and not lzfse_capable: raise ValueError('LZFSE/LZVN compression detected, no decompressor available!') if self.logicalSize >= 209715200: temp_file = tempfile.SpooledTemporaryFile(209715200) super(HFSCompressedResourceFork, self).readAllBuffer(True, temp_file) temp_file.seek(0) buff = mmap.mmap(temp_file.fileno(), 0) # memory mapped file to access as buffer else: buff = super(HFSCompressedResourceFork, self).readAllBuffer() r = b"" if self.compression_type in [7, 11]: # lzvn or lzfse # Does it ever go here???? raise ValueError("Did not expect type " + str(self.compression_type) + " in resource fork") try: # The following is only for lzvn, not encountered lzfse yet! data_start = self.header.headerSize compressed_stream = buff[data_start:self.header.totalSize] decompressed = lzvn_decompress(compressed_stream, self.header.totalSize - self.header.headerSize, self.uncompressed_size) if output_file: output_file.write(decompressed) elif self.uncompressed_size < 209715200: r += decompressed except liblzfse.error as ex: raise ValueError("Exception from lzfse_lzvn decompressor") elif self.compression_type in [8, 12]: # lzvn or lzfse in 64k chunks try: # The following is only for lzvn, not encountered lzfse yet! full_uncomp = self.uncompressed_size chunk_uncomp = 65536 i = 0 src_offset = self.header.headerSize for offset in self.header.chunkOffsets: compressed_size = offset - src_offset data = buff[src_offset:offset] #input_file.read(compressed_size) src_offset = offset if full_uncomp <= 65536: chunk_uncomp = full_uncomp else: chunk_uncomp = 65536 if len(self.header.chunkOffsets) == i + 1: # last chunk chunk_uncomp = full_uncomp - (65536 * i) if chunk_uncomp < compressed_size and data[0] == 0x06: decompressed = data[1:] else: decompressed = lzvn_decompress(data, compressed_size, chunk_uncomp) if output_file: output_file.write(decompressed) elif self.uncompressed_size < 209715200: r += decompressed i += 1 except liblzfse.error as ex: raise ValueError("Exception from lzfse_lzvn decompressor") else: base = self.header.headerSize + 4 for b in self.blocks.HFSPlusCmpfRsrcBlockArray: decompressed = zlib.decompress(buff[base+b.offset:base+b.offset+b.size]) if output_file: output_file.write(decompressed) elif self.uncompressed_size < 209715200: r += decompressed if self.logicalSize >= 209715200: mmap.close() temp_file.close() return r class HFSVolume(object): def __init__(self, pytsk_image, offset=0): self.img = pytsk_image self.offset = offset try: data = self.read(0, 0x1000) self.header = HFSPlusVolumeHeader.parse(data[0x400:0x800]) assert self.header.signature == 0x4858 or self.header.signature == 0x482B except AssertionError: raise ValueError("Not an HFS+ image") #self.is_hfsx = self.header.signature == 0x4858 self.blockSize = self.header.blockSize self.allocationFile = HFSFile(self, self.header.allocationFile, kHFSAllocationFileID) self.allocationBitmap = self.allocationFile.readAllBuffer() self.extentsFile = HFSFile(self, self.header.extentsFile, kHFSExtentsFileID) self.extentsTree = ExtentsOverflowTree(self.extentsFile) self.catalogFile = HFSFile(self, self.header.catalogFile, kHFSCatalogFileID) self.xattrFile = HFSFile(self, self.header.attributesFile, kHFSAttributesFileID) self.catalogTree = CatalogTree(self.catalogFile) self.xattrTree = AttributesTree(self.xattrFile) self.hasJournal = self.header.attributes & (1 << kHFSVolumeJournaledBit) def read(self, offset, size): return self.img.read(self.offset + offset, size) def volumeID(self): return struct.pack(">LL", self.header.finderInfo[6], self.header.finderInfo[7]) def isBlockInUse(self, block): thisByte = self.allocationBitmap[block // 8] return (thisByte & (1 << (7 - (block % 8)))) != 0 def unallocatedBlocks(self): for i in range(self.header.totalBlocks): if not self.isBlockInUse(i): yield i, self.read(i*self.blockSize, self.blockSize) def getExtentsOverflowForFile(self, fileID, startBlock, forkType=kForkTypeData): return self.extentsTree.searchExtents(fileID, forkType, startBlock) def getXattr(self, fileID, name): return self.xattrTree.searchXattr(fileID, name) def getFileByPath(self, path): return self.catalogTree.getRecordFromPath(path) def getFinderDateAdded(self, path): k,v = self.catalogTree.getRecordFromPath(path) if k and v.recordType == kHFSPlusFileRecord: return v.data.ExtendedFileInfo.finderDateAdded elif k and v.recordType == kHFSPlusFolderRecord: return v.data.ExtendedFolderInfo.finderDateAdded return 0 def listFolderContents(self, path): k,v = self.catalogTree.getRecordFromPath(path) if not k or v.recordType != kHFSPlusFolderRecord: return for k,v in self.catalogTree.getFolderContents(v.data.folderID): if v.recordType == kHFSPlusFolderRecord: print(v.data.folderID, getString(k) + "/") elif v.recordType == kHFSPlusFileRecord: print(v.data.fileID, getString(k)) def listFinderData(self, path): '''Returns finder data''' finder_data = {} k,v = self.catalogTree.getRecordFromPath(path) date_added = 0 if k and v.recordType == kHFSPlusFileRecord: date_added = v.data.ExtendedFileInfo.finderDateAdded if v.data.FileInfo.fileType: finder_data['fileType'] = v.data.FileInfo.fileType if v.data.FileInfo.fileCreator: finder_data['fileCreator'] = v.data.FileInfo.fileCreator if v.data.FileInfo.finderFlags: finder_data['finderFlags'] = v.data.FileInfo.finderFlags if v.data.ExtendedFileInfo.extendedFinderFlags: finder_data['extendedFinderFlags'] = v.data.ExtendedFileInfo.extendedFinderFlags elif k and v.recordType == kHFSPlusFolderRecord: date_added = v.data.ExtendedFolderInfo.finderDateAdded if v.data.FolderInfo.finderFlags: finder_data['FinderFlags'] = v.data.FolderInfo.finderFlags if v.data.ExtendedFolderInfo.extendedFinderFlags: finder_data['extendedFinderFlags'] = v.data.ExtendedFolderInfo.extendedFinderFlags if date_added: finder_data['DateAdded'] = date_added return finder_data def getCnidForPath(self, path): k,v = self.catalogTree.getRecordFromPath(path) if not v: raise ValueError("Path not found") if k and v.recordType == kHFSPlusFileRecord: return v.data.fileID elif k and v.recordType == kHFSPlusFolderThreadRecord: return v.data.folderID def getXattrsByPath(self, path): file_id = self.getCnidForPath(path) return self.xattrTree.getAllXattrs(file_id) def getXattrByPath(self, path, name): file_id = self.getCnidForPath(path) return self.getXattr(file_id, name) ''' Compression type in Xattr as per apple: Source: https://opensource.apple.com/source/copyfile/copyfile-138/copyfile.c.auto.html case 3: /* zlib-compressed data in xattr */ case 4: /* 64k chunked zlib-compressed data in resource fork */ case 7: /* LZVN-compressed data in xattr */ case 8: /* 64k chunked LZVN-compressed data in resource fork */ case 9: /* uncompressed data in xattr (similar to but not identical to CMP_Type1) */ case 10: /* 64k chunked uncompressed data in resource fork */ case 11: /* LZFSE-compressed data in xattr */ case 12: /* 64k chunked LZFSE-compressed data in resource fork */ /* valid compression type, we want to copy. */ break; case 5: /* specifies de-dup within the generation store. Don't copy decmpfs xattr. */ copyfile_debug(3, "compression_type <5> on attribute com.apple.decmpfs for src file %s is not copied.", s->src ? s->src : "(null string)"); continue; case 6: /* unused */ ''' def readFile(self, path, output_file=None): '''Reads file specified by 'path' and copies it out into output_file if valid, else returns as string. Warning: If file is too large, over 200 MiB, then it will return b'', and only write to output_file. ''' k,v = self.catalogTree.getRecordFromPath(path) if not v: raise ValueError("File not found") data = b'' assert v.recordType == kHFSPlusFileRecord xattr = self.getXattr(v.data.fileID, "com.apple.decmpfs") if xattr: decmpfs = HFSPlusDecmpfs.parse(xattr) log.debug("decmpfs.compression_type={}".format(str(decmpfs.compression_type))) if decmpfs.compression_type == 1: data = xattr[16:] if output_file: output_file.write(data) elif decmpfs.compression_type == 3: if decmpfs.uncompressed_size == len(xattr) - 16: data = xattr[16:] else: data = zlib.decompress(xattr[16:]) if output_file: output_file.write(data) elif decmpfs.compression_type == 4: f = HFSCompressedResourceFork(self, v.data.resourceFork, v.data.fileID, decmpfs.compression_type, decmpfs.uncompressed_size) data = f.readAllBuffer(True, output_file) elif decmpfs.compression_type in [7, 11]: if xattr[16] == 0x06: # perhaps even 0xF? data = xattr[17:] #tested OK else: #tested OK uncompressed_size = struct.unpack('<I', xattr[8:12])[0] compressed_size = len(xattr) - 16 compressed_stream = xattr[16:] data = lzvn_decompress(compressed_stream, compressed_size, uncompressed_size) if output_file: output_file.write(data) elif decmpfs.compression_type in [8, 12]: # tested for type 8 , OK<|fim▁hole|> else: f = HFSFile(self, v.data.dataFork, v.data.fileID) data = f.readAllBuffer(True, output_file) return data def readJournal(self): jb = self.read(self.header.journalInfoBlock * self.blockSize, self.blockSize) jib = JournalInfoBlock.parse(jb) return self.read(jib.offset,jib.size) def GetFileMACTimesFromFileRecord(self, v): times = { 'c_time':None, 'm_time':None, 'cr_time':None, 'a_time':None } catalog_file = v.data times['c_time'] = CommonFunctions.ReadMacHFSTime(catalog_file.attributeModDate) times['m_time'] = CommonFunctions.ReadMacHFSTime(catalog_file.contentModDate) times['cr_time'] = CommonFunctions.ReadMacHFSTime(catalog_file.createDate) times['a_time'] = CommonFunctions.ReadMacHFSTime(catalog_file.accessDate) return times def GetFileMACTimes(self, file_path): ''' Returns dictionary {c_time, m_time, cr_time, a_time} where cr_time = created time and c_time = Last time inode/mft modified ''' k,v = self.catalogTree.getRecordFromPath(file_path) if k and v.recordType in (kHFSPlusFileRecord, kHFSPlusFolderRecord): return self.GetFileMACTimesFromFileRecord(v) raise ValueError("Path not found or not file/folder!") def IsValidFilePath(self, path): '''Check if a file path is valid, does not check for folders!''' k,v = self.catalogTree.getRecordFromPath(path) if not v: return False return v.recordType == kHFSPlusFileRecord #TODO: Check for hard links , sym links? def IsValidFolderPath(self, path): '''Check if a folder path is valid''' k,v = self.catalogTree.getRecordFromPath(path) if not v: return False return v.recordType == kHFSPlusFolderRecord #TODO: Check for hard links , sym links? def IsSymbolicLink(self, path): '''Check if a path points to a file/folder or symbolic link''' mode = self.GetFileMode(path) if mode: return (mode & S_IFLNK) == S_IFLNK return False def GetFileSizeFromFileRecord(self, v): xattr = self.getXattr(v.data.fileID, "com.apple.decmpfs") if xattr: decmpfs = HFSPlusDecmpfs.parse(xattr) return decmpfs.uncompressed_size #TODO verify for all cases! else: return v.data.dataFork.logicalSize def GetFileSize(self, path): '''For a given file path, gets logical file size''' k,v = self.catalogTree.getRecordFromPath(path) if k and v.recordType == kHFSPlusFileRecord: return self.GetFileSizeFromFileRecord(v) else: raise ValueError("Path not found") def GetUserAndGroupID(self, path): k,v = self.catalogTree.getRecordFromPath(path) if k and v.recordType in (kHFSPlusFileRecord, kHFSPlusFolderRecord): return (v.data.HFSPlusBSDInfo.ownerID, v.data.HFSPlusBSDInfo.groupID) else: raise ValueError("Path not found") def GetFileMode(self, path): '''Returns the file or folder's fileMode ''' k,v = self.catalogTree.getRecordFromPath(path) if k and v and v.recordType in (kHFSPlusFileRecord, kHFSPlusFolderRecord): return v.data.HFSPlusBSDInfo.fileMode else: raise ValueError("Path not found or not a file/folder")<|fim▁end|>
f = HFSCompressedResourceFork(self, v.data.resourceFork, v.data.fileID, decmpfs.compression_type, decmpfs.uncompressed_size) data = f.readAllBuffer(True, output_file) if output_file: output_file.write(data)
<|file_name|>run_on_dates.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys import os.path<|fim▁hole|> """ Run snapstream reader script for several files and out a table of match counts. Example: $ python run_on_dates.py eg01china.c 2014-01-01 2014-07-01 """ def validate(date_string): try: datetime.datetime.strptime(date_string,"%Y-%m-%d") except ValueError as e: raise ValueError("Incorrect date format, should be YYYY-MM-DD") if __name__ == "__main__": start_time = time.time() if len(sys.argv) != 4: print("3 arguments are needed, file, begin date and end date") exit(-1) file_name = sys.argv[1] begin_date = sys.argv[2] end_date = sys.argv[3] if os.path.isfile(file_name) is False: print(file_name + " does not exist or is an invalid file") exit(-1) validate(begin_date) validate(end_date) print("Running %s from %s to %s..." % (file_name, begin_date, end_date)) data_files = ["Data/" + f for f in os.listdir("Data") if f >= begin_date and f < end_date] data_files.sort() full_output = open("full_output.txt","w") print("\t".join(["dt","total_matches_cnt","matching_programs_cnt","total_programs_cnt","selected_programs_cnt"])) os.system("gcc " + file_name) for f in data_files: date_string = f[5:15] full_output.write(f + "\n" + "====================\n\n") proc = subprocess.Popen(["./a.out",f], stdout=subprocess.PIPE) proc_out = proc.communicate()[0].decode('utf-8') full_output.write(proc_out) proc_out = proc_out.split('\n') print("\t".join([date_string]) + '\t' + proc_out[-2]) full_output.close() print(str(time.time() - start_time) + " seconds taken")<|fim▁end|>
import datetime import subprocess import time
<|file_name|>SubscriptionMigrationTest.java<|end_file_name|><|fim▁begin|>/* * Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.topic.impl.reliable; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.partition.MigrationState; import com.hazelcast.partition.MigrationListener; import com.hazelcast.partition.ReplicaMigrationEvent; import com.hazelcast.ringbuffer.impl.RingbufferService; import com.hazelcast.test.AssertTask; import com.hazelcast.test.HazelcastParallelClassRunner; import com.hazelcast.test.HazelcastTestSupport; import com.hazelcast.test.OverridePropertyRule; import com.hazelcast.test.TestHazelcastInstanceFactory; import com.hazelcast.test.annotation.ParallelJVMTest; import com.hazelcast.test.annotation.QuickTest; import com.hazelcast.topic.ITopic; import com.hazelcast.topic.Message; import com.hazelcast.topic.MessageListener; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import java.util.Collection; import java.util.HashSet; import java.util.concurrent.atomic.AtomicInteger; import static org.junit.Assert.assertTrue; @Category({QuickTest.class, ParallelJVMTest.class}) @RunWith(HazelcastParallelClassRunner.class) public class SubscriptionMigrationTest extends HazelcastTestSupport { @Rule public OverridePropertyRule overridePropertyRule = OverridePropertyRule.set("hazelcast.partition.count", "2"); // gh issue: https://github.com/hazelcast/hazelcast/issues/13602 @Test public void testListenerReceivesMessagesAfterPartitionIsMigratedBack() { TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(); HazelcastInstance instance1 = factory.newHazelcastInstance(); final String rtNameOnPartition0 = generateReliableTopicNameForPartition(instance1, 0); final String rtNameOnPartition1 = generateReliableTopicNameForPartition(instance1, 1); ITopic<String> topic0 = instance1.getReliableTopic(rtNameOnPartition0); ITopic<String> topic1 = instance1.getReliableTopic(rtNameOnPartition1); <|fim▁hole|> final PayloadMessageListener<String> listener1 = new PayloadMessageListener<String>(); topic0.addMessageListener(listener0); topic1.addMessageListener(listener1); topic0.publish("itemA"); topic1.publish("item1"); HazelcastInstance instance2 = factory.newHazelcastInstance(); // 1 primary, 1 backup migration assertEqualsEventually(2, migrationListener.partitionMigrationCount); instance2.shutdown(); assertEqualsEventually(3, migrationListener.partitionMigrationCount); topic0.publish("itemB"); topic1.publish("item2"); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue(listener0.isReceived("itemA")); assertTrue(listener0.isReceived("itemB")); assertTrue(listener1.isReceived("item1")); assertTrue(listener1.isReceived("item2")); } }); } public class PayloadMessageListener<V> implements MessageListener<V> { private Collection<V> receivedMessages = new HashSet<V>(); @Override public void onMessage(Message<V> message) { receivedMessages.add(message.getMessageObject()); } boolean isReceived(V message) { return receivedMessages.contains(message); } } public class CountingMigrationListener implements MigrationListener { AtomicInteger partitionMigrationCount = new AtomicInteger(); @Override public void migrationStarted(MigrationState state) { } @Override public void migrationFinished(MigrationState state) { } @Override public void replicaMigrationCompleted(ReplicaMigrationEvent event) { partitionMigrationCount.incrementAndGet(); } @Override public void replicaMigrationFailed(ReplicaMigrationEvent event) { } } private String generateReliableTopicNameForPartition(HazelcastInstance instance, int partitionId) { return generateKeyForPartition(instance, RingbufferService.TOPIC_RB_PREFIX, partitionId); } }<|fim▁end|>
final CountingMigrationListener migrationListener = new CountingMigrationListener(); instance1.getPartitionService().addMigrationListener(migrationListener); final PayloadMessageListener<String> listener0 = new PayloadMessageListener<String>();
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from datetime import timedelta, datetime from django.contrib import messages from django.contrib.contenttypes.models import ContentType from django.core.cache import cache from django.db import transaction from django.http import Http404 from django.http import HttpResponse from django.shortcuts import get_object_or_404, HttpResponseRedirect, reverse, redirect from django.utils.dateparse import parse_datetime from django.views.generic import TemplateView, View from django.views.generic.list import ListView from tagging.models import TaggedItem from account.models import User from account.permissions import is_admin_or_root from contest.base import BaseContestMixin from contest.statistics import get_participant_score, calculate_problems from problem.models import Problem from problem.statistics import get_accept_problem_list, get_attempted_problem_list from utils.language import LANG_CHOICE from .models import Contest, ContestProblem, ContestInvitation, ContestUserRating from .tasks import add_participant_with_invitation def time_formatter(seconds): return "%d:%.2d:%.2d" % (seconds // 3600, seconds % 3600 // 60, seconds % 60) class DashboardView(BaseContestMixin, TemplateView): template_name = 'contest/index.jinja2' def test_func(self): if self.privileged: return True return self.contest.access_level > 0 def get_context_data(self, **kwargs): data = super(DashboardView, self).get_context_data(**kwargs) if self.registered: data['registered'] = True if self.user.is_authenticated and self.contest.access_level == 30 and self.contest.status == -1: if self.contest.contestparticipant_set.filter(user=self.user).exists(): data['public_register'] = 1 else: data['public_register'] = -1 # tags data['tagged_contest_problem_list'] = data['contest_problem_list'] if self.contest.contest_type == 1: tagged_items = list(TaggedItem.objects.filter(content_type=ContentType.objects.get_for_model(Problem)) .filter(object_id__in=list(map(lambda x: x.problem_id, data['contest_problem_list']))) .select_related("tag")) tag_filter = self.request.GET.get("tag") if tag_filter: data['tagged_contest_problem_list'] = [] for contest_problem in data['contest_problem_list']: items = [x for x in tagged_items if x.object_id == contest_problem.problem_id] if items: contest_problem.tags = list(map(lambda x: x.tag.name, items)) if tag_filter and hasattr(contest_problem, "tags") and tag_filter in contest_problem.tags: data['tagged_contest_problem_list'].append(contest_problem) data['has_permission'] = super(DashboardView, self).test_func() for problem in data['contest_problem_list']: problem.personal_label = 0 if data['has_permission'] and self.user.is_authenticated: # problem red and green status attempt_list = set(get_attempted_problem_list(self.request.user.id, self.contest.id)) accept_list = set(get_accept_problem_list(self.request.user.id, self.contest.id)) for problem in data['contest_problem_list']: if problem.problem_id in accept_list: problem.personal_label = 1 elif problem.problem_id in attempt_list: problem.personal_label = -1 else: problem.personal_label = 0 if self.contest.contest_type == 1: all_accept_list = set(get_accept_problem_list(self.request.user.id)) for problem in data['contest_problem_list']: if problem.problem_id in all_accept_list and problem.personal_label <= 0: problem.personal_label = 2 # show display rank if self.contest.contest_type == 0: if self.participant is not None: self_displayed_rank_template = 'display_rank_cp_%d' % self.participant.pk data["rank"] = cache.get(self_displayed_rank_template) if data["rank"] is None: if self.virtual_progress is not None: data["rank"] = get_participant_score(self.contest, self.user.pk, self.virtual_progress) else: data["rank"] = get_participant_score(self.contest, self.user.pk) if self.contest.common_status_access_level < 0: data["rank"].pop("actual_rank", None) cache.set(self_displayed_rank_template, data["rank"], 15) if data["rank"] is not None: data["rank"].update(user=self.participant) # make sure problem status is correct (for VP purpose) if self.virtual_progress is not None: calculate_problems(self.contest, self.contest.contest_problem_list, self.virtual_progress) # `contest.contest_problem_list` is data["contest_problem_list"]. Same thing. if self.contest.scoring_method == "oi": data['enable_scoring'] = True for problem in data['contest_problem_list']: problem.max_score = int(round(problem.max_score / 100 * problem.weight)) problem.avg_score = round(problem.avg_score / 100 * problem.weight, 1) data['authors'] = self.contest.authors.all() # color settings data['level_colors'] = ["", "green", "teal", "blue", "orange", "red"] return data class ContestProblemDetail(BaseContestMixin, TemplateView): template_name = 'contest/problem.jinja2' def get_context_data(self, **kwargs): data = super(ContestProblemDetail, self).get_context_data(**kwargs) data['contest_problem'] = get_object_or_404(ContestProblem, identifier=self.kwargs.get('pid'), contest=self.contest) data['problem'] = data['contest_problem'].problem # submit part data['lang_choices'] = list(filter(lambda k: k[0] in self.contest.supported_language_list, LANG_CHOICE)) # if self.request.user.is_authenticated: # data['attempt_left'] = settings.SUBMISSION_ATTEMPT_LIMIT - self.contest.submission_set.filter( # author=self.request.user, # problem_id=data['contest_problem'].problem_id).count() # if self.contest.status != 0: # data['attempt_left'] = settings.SUBMISSION_ATTEMPT_LIMIT return data class ContestStatements(BaseContestMixin, View): def get(self, request, *args, **kwargs): if not self.contest.pdf_statement: raise Http404 return HttpResponse(self.contest.pdf_statement.read(), content_type="application/pdf") class ContestBoundUser(View): def post(self, request, cid): if not request.user.is_authenticated: messages.error(request, "请先登录。") else: invitation_code = request.POST.get('code', '') try: invitation = ContestInvitation.objects.get(code=invitation_code) add_participant_with_invitation(cid, invitation.pk, request.user) messages.success(request, "你已成功加入。") except ContestInvitation.DoesNotExist: messages.error(request, "邀请码有误。") return HttpResponseRedirect(reverse('contest:dashboard', kwargs={'cid': cid})) class ContestPublicToggleRegister(View): def post(self, request, cid): if not request.user.is_authenticated: messages.error(request, "请先登录。") else: contest = get_object_or_404(Contest, pk=cid) if contest.access_level == 30 and contest.status == -1: with transaction.atomic(): if not contest.contestparticipant_set.filter(user=request.user).exists(): contest.contestparticipant_set.get_or_create(user=request.user) else: contest.contestparticipant_set.filter(user=request.user).delete() return HttpResponseRedirect(reverse('contest:dashboard', kwargs={'cid': cid})) class ContestList(ListView): template_name = 'contest/contest_list.jinja2' paginate_by = 30 context_object_name = 'contest_list' def get_queryset(self): user = self.request.user if self.request.user.is_authenticated else None return Contest.objects.get_status_list(show_all=is_admin_or_root(self.request.user), filter_user=user, contest_type=0) def get_context_data(self, **kwargs): # pylint: disable=arguments-differ data = super().get_context_data(**kwargs) data["hide_header"] = True return data class ContestGymList(ListView): template_name = 'contest/contest_gym_list.jinja2' paginate_by = 30 context_object_name = 'contest_list' def get_queryset(self): user = self.request.user if self.request.user.is_authenticated else None return Contest.objects.get_status_list(show_all=is_admin_or_root(self.request.user), filter_user=user, sorting_by_id=True, contest_type=1) def get_context_data(self, **kwargs): # pylint: disable=arguments-differ data = super().get_context_data(**kwargs) data["hide_header"] = True return data class ContestRatings(ListView): template_name = 'contest/contest_ratings.jinja2' context_object_name = 'global_rating' paginate_by = 100 def dispatch(self, request, *args, **kwargs): q = request.GET.get('q', '') if request.GET.get('full'): self.full = True elif q.isdigit(): self.user = get_object_or_404(User, pk=q) self.full = False elif request.user.is_authenticated: self.user = request.user self.full = False else: self.full = True return super().dispatch(request, *args, **kwargs) def get_queryset(self): if self.full: return User.objects.filter(rating__gt=0).order_by("-rating") else: return User.objects.filter(rating__gt=0).order_by("-rating")[:15] def get_context_data(self, **kwargs): # pylint: disable=arguments-differ data = super().get_context_data(**kwargs) data['full'] = self.full if not self.full: data['query_user'] = self.user data['max_rating'], data['min_rating'] = 2000, 1000 data['rating_list'] = ContestUserRating.objects.select_related('contest').filter(user=self.user) if data['rating_list']: data['max_rating'] = max(data['max_rating'], max(map(lambda x: x.rating, data['rating_list']))) data['min_rating'] = min(data['min_rating'], max(map(lambda x: x.rating, data['rating_list']))) return data class ContestVirtualParticipantJoin(BaseContestMixin, View):<|fim▁hole|> def test_func(self): return self.vp_available def post(self, request, *args, **kwargs): start_time = parse_datetime(request.POST["time"]) redirect_link = reverse('contest:dashboard', kwargs={'cid': self.contest.pk}) if start_time <= datetime.now(): messages.error(request, "输入时间应晚于当前时间。") return redirect(redirect_link) if start_time - datetime.now() > timedelta(days=1): messages.error(request, "不支持预约 24 小时以后的比赛。") return redirect(redirect_link) self.contest.contestparticipant_set.create(user=self.request.user, join_time=start_time) return redirect(redirect_link) class ContestReward(BaseContestMixin, TemplateView): template_name = 'contest/reward.jinja2' def get_context_data(self, **kwargs): data = super(ContestReward, self).get_context_data(**kwargs) data['blog_list'] = self.contest.blog_set.with_likes().with_likes_flag(self.request.user) return data<|fim▁end|>
<|file_name|>ServiceItemResource.java<|end_file_name|><|fim▁begin|>/* * Claudia Project * http://claudia.morfeo-project.org * * (C) Copyright 2010 Telefonica Investigacion y Desarrollo * S.A.Unipersonal (Telefonica I+D) * * See CREDITS file for info about members and contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the Affero GNU General Public License (AGPL) as * published by the Free Software Foundation; either version 3 of the License, * or (at your option) 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 Affero GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * If you want to use this software an plan to distribute a * proprietary application in any way, and you are not licensing and * distributing your source code under AGPL, you probably need to * purchase a commercial license of the product. Please contact * [email protected] for more information. */ package com.telefonica.claudia.smi.deployment; import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.log4j.Logger; import org.restlet.Context; import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.resource.DomRepresentation; import org.restlet.resource.Representation; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; import org.restlet.resource.Variant; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import com.telefonica.claudia.smi.Main; import com.telefonica.claudia.smi.URICreation; public class ServiceItemResource extends Resource { private static Logger log = Logger.getLogger("com.telefonica.claudia.smi.ServiceItemResource"); String vdcId; String vappId; String orgId; public ServiceItemResource(Context context, Request request, Response response) { super(context, request, response); this.vappId = (String) getRequest().getAttributes().get("vapp-id"); this.vdcId = (String) getRequest().getAttributes().get("vdc-id"); this.orgId = (String) getRequest().getAttributes().get("org-id"); // Get the item directly from the "persistence layer". if (this.orgId != null && this.vdcId!=null && this.vappId!=null) { // Define the supported variant. getVariants().add(new Variant(MediaType.TEXT_XML)); // By default a resource cannot be updated. setModifiable(true); } else { // This resource is not available. setAvailable(false); } } <|fim▁hole|> @Override public Representation represent(Variant variant) throws ResourceException { // Generate the right representation according to its media type. if (MediaType.TEXT_XML.equals(variant.getMediaType())) { try { DeploymentDriver actualDriver= (DeploymentDriver) getContext().getAttributes().get(DeploymentApplication.ATTR_PLUGIN_DEPLOYMENT); String serviceInfo = actualDriver.getService(URICreation.getFQN(orgId, vdcId, vappId)); // Substitute the macros in the description serviceInfo = serviceInfo.replace("@HOSTNAME", "http://" + Main.serverHost + ":" + Main.serverPort); if (serviceInfo==null) { log.error("Null response from the SM."); getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); return null; } DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(serviceInfo)); Document doc = db.parse(is); DomRepresentation representation = new DomRepresentation( MediaType.TEXT_XML, doc); log.info("Data returned for service "+ URICreation.getFQN(orgId, vdcId, vappId) + ": \n\n" + serviceInfo); // Returns the XML representation of this document. return representation; } catch (IOException e) { log.error("Time out waiting for the Lifecycle Controller."); getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); return null; } catch (SAXException e) { log.error("Retrieved data was not in XML format: " + e.getMessage()); getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); return null; } catch (ParserConfigurationException e) { log.error("Error trying to configure parser."); getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); return null; } } return null; } /** * Handle DELETE requests. */ @Override public void removeRepresentations() throws ResourceException { DeploymentDriver actualDriver= (DeploymentDriver) getContext().getAttributes().get(DeploymentApplication.ATTR_PLUGIN_DEPLOYMENT); try { actualDriver.undeploy(URICreation.getFQN(orgId, vdcId, vappId)); } catch (IOException e) { log.error("Time out waiting for the Lifecycle Controller."); getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); return; } // Tells the client that the request has been successfully fulfilled. getResponse().setStatus(Status.SUCCESS_NO_CONTENT); } }<|fim▁end|>
/** * Handle GETS */
<|file_name|>dump-rename.js<|end_file_name|><|fim▁begin|>#!/usr/bin/env node var JavaScriptBuffer = require('../type-inference'), fs = require('fs'), clc = require('cli-color'); var filename = process.argv[2]; var text = fs.readFileSync(filename, {encoding:"utf8"}); var lines = text.split(/\r?\n|\r/); var buffer = new JavaScriptBuffer; buffer.add(filename, text); var groups = buffer.renamePropertyName(process.argv[3] || "add"); groups.forEach(function(group) { console.log(clc.green("---------------- (" + group.length + ")")); group.forEach(function (item,index) { if (index > 0) console.log(clc.blackBright("--")); var idx = item.start.line - 1;<|fim▁hole|> clc.red(line.substring(item.start.column, item.end.column)) + clc.black(line.substring(item.end.column)); console.log(clc.black(lines[idx-1]) || ''); console.log(line); console.log(clc.black(lines[idx+1]) || ''); }); }); console.log(clc.green("----------------"));<|fim▁end|>
var line = lines[idx]; line = clc.black(line.substring(0,item.start.column)) +
<|file_name|>FloatRectCairo.cpp<|end_file_name|><|fim▁begin|>/* * Copyright (C) 2010 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,<|fim▁hole|> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "FloatRect.h" #include <cairo.h> namespace WebCore { FloatRect::FloatRect(const cairo_rectangle_t& r) : m_location(r.x, r.y) , m_size(r.width, r.height) { } FloatRect::operator cairo_rectangle_t() const { cairo_rectangle_t r = { x(), y(), width(), height() }; return r; } } // namespace WebCore<|fim▁end|>
<|file_name|>three_d_earth.py<|end_file_name|><|fim▁begin|>from webalchemy import config FREEZE_OUTPUT = 'webglearth.html' class Earth: def __init__(self): self.width = window.innerWidth self.height = window.innerHeight # Earth params self.radius = 0.5 self.segments = 64 self.rotation = 6 self.scene = new(THREE.Scene) self.camera = new(THREE.PerspectiveCamera, 45, self.width / self.height, 0.01, 1000) self.camera.position.z = 1.5 self.renderer = new(THREE.WebGLRenderer) self.renderer.setSize(self.width, self.height) self.scene.add(new(THREE.AmbientLight, 0x333333)) self.light = new(THREE.DirectionalLight, 0xffffff, 1) self.light.position.set(5, 3, 5) self.scene.add(self.light) self.sphere = self.createSphere(self.radius, self.segments) self.sphere.rotation.y = self.rotation self.scene.add(self.sphere) self.clouds = self.createClouds(self.radius, self.segments) self.clouds.rotation.y = self.rotation self.scene.add(self.clouds) self.stars = self.createStars(90, 64) self.scene.add(self.stars) self.mx = 0 self.my = 0 self.mdx = 0 self.mdy = 0 self.angx = 0 self.angy = 0 self.renderer.domElement.onmouseup = self.wrap(self, self.mouseup) self.renderer.domElement.onmousedown = self.wrap(self, self.mousedown) def mousemove(self, e): self.mdx += e.screenX - self.mx self.mdy += e.screenY - self.my self.mx = e.screenX<|fim▁hole|> self.my = e.screenY def mouseup(self, e): self.renderer.domElement.onmousemove = None def mousedown(self, e): self.mx = e.screenX self.my = e.screenY self.renderer.domElement.onmousemove = self.wrap(self, self.mousemove) def wrap(self, object, method): def wrapper(): return method.apply(object, arguments) return wrapper def render(self): if Math.abs(self.mdx) > 1.1 or Math.abs(self.mdy) > 1.1: self.angx -= self.mdx/5000 self.mdx -= self.mdx/20 if Math.abs(self.angy + self.mdy/5000) < 3.14/2: self.angy += self.mdy/10000 self.mdy -= self.mdy/20 self.camera.position.x = 1.5 *Math.sin(self.angx) *Math.cos(self.angy) self.camera.position.z = 1.5 *Math.cos(self.angx) *Math.cos(self.angy) self.camera.position.y = 1.5 *Math.sin(self.angy) self.camera.lookAt(self.scene.position) self.sphere.rotation.y += 0.0005 self.clouds.rotation.y += 0.0004 requestAnimationFrame(self.wrap(self, self.render)) self.renderer.render(self.scene, self.camera) def createSphere(self, radius, segments): geometry = new(THREE.SphereGeometry, radius, segments, segments) material = new(THREE.MeshPhongMaterial, { 'map': THREE.ImageUtils.loadTexture('static/lowres_noclouds.jpg'), 'bumpMap': THREE.ImageUtils.loadTexture('static/lowres_elevbump.jpg'), 'bumpScale': 0.005, 'specularMap': THREE.ImageUtils.loadTexture('static/lowres_water.png'), 'specular': new(THREE.Color, 'grey') }) return new(THREE.Mesh, geometry, material) def createClouds(self, radius, segments): geometry = new(THREE.SphereGeometry, radius + 0.005, segments, segments) material = new(THREE.MeshPhongMaterial, { 'map': THREE.ImageUtils.loadTexture('static/lowres_fairclouds.png'), 'transparent': true }) return new(THREE.Mesh, geometry, material) def createStars(self, radius, segments): geometry = new(THREE.SphereGeometry, radius, segments, segments) material = new(THREE.MeshBasicMaterial, { 'map': THREE.ImageUtils.loadTexture('static/lowres_starfield.png'), 'side': THREE.BackSide }) return new(THREE.Mesh, geometry, material) class ThreeDEarth: include = ['https://rawgithub.com/mrdoob/three.js/master/build/three.min.js'] config = config.from_object(__name__) def initialize(self, **kwargs): self.rdoc = kwargs['remote_document'] self.rdoc.body.style( margin=0, overflow='hidden', backgroundColor='#000' ) self.earth = self.rdoc.new(Earth) self.rdoc.body.append(self.earth.renderer.domElement) self.rdoc.stylesheet.rule('a').style(color='#FFF') e = self.rdoc.body.element('p') e.prop.innerHTML = "Powered by <a href='https://github.com/skariel/webalchemy'>Webalchemy</a><br/>" +\ "Adapted from <a href='https://github.com/turban/webgl-earth/blob/master/index.html'>this</a><br/>" +\ "Pure Python source is <a href='https://github.com/skariel/webalchemy/blob/master/examples/three_d_earth/three_d_earth.py'>here</a>" e.style( color='#FFF', position='absolute', left='10px', top='10px' ) self.earth.render()<|fim▁end|>
<|file_name|>optimization_guide_web_contents_observer.cc<|end_file_name|><|fim▁begin|>// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h" #include "chrome/browser/optimization_guide/chrome_hints_manager.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" #include "chrome/browser/prefetch/no_state_prefetch/no_state_prefetch_manager_factory.h" #include "chrome/browser/profiles/profile.h" #include "components/no_state_prefetch/browser/no_state_prefetch_manager.h" #include "components/optimization_guide/core/hints_fetcher.h" #include "components/optimization_guide/core/hints_processing_util.h" #include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/core/optimization_guide_features.h" #include "components/optimization_guide/proto/hints.pb.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h" namespace { bool IsValidOptimizationGuideNavigation( content::NavigationHandle* navigation_handle) { if (!navigation_handle->IsInPrimaryMainFrame()) return false; if (!navigation_handle->GetURL().SchemeIsHTTPOrHTTPS()) return false; // Now check if this is a NSP navigation. NSP is not a valid navigation. prerender::NoStatePrefetchManager* no_state_prefetch_manager = prerender::NoStatePrefetchManagerFactory::GetForBrowserContext( navigation_handle->GetWebContents()->GetBrowserContext()); if (!no_state_prefetch_manager) { // Not a NSP navigation if there is no NSP manager. return true; } return !(no_state_prefetch_manager->IsWebContentsPrerendering( navigation_handle->GetWebContents())); } } // namespace OptimizationGuideWebContentsObserver::OptimizationGuideWebContentsObserver( content::WebContents* web_contents) : content::WebContentsObserver(web_contents) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); optimization_guide_keyed_service_ = OptimizationGuideKeyedServiceFactory::GetForProfile( Profile::FromBrowserContext(web_contents->GetBrowserContext())); } OptimizationGuideWebContentsObserver::~OptimizationGuideWebContentsObserver() = default; OptimizationGuideNavigationData* OptimizationGuideWebContentsObserver:: GetOrCreateOptimizationGuideNavigationData( content::NavigationHandle* navigation_handle) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_EQ(web_contents(), navigation_handle->GetWebContents()); NavigationHandleData* navigation_handle_data = NavigationHandleData::GetOrCreateForNavigationHandle(*navigation_handle); OptimizationGuideNavigationData* navigation_data = navigation_handle_data->GetOptimizationGuideNavigationData(); if (!navigation_data) { // We do not have one already - create one. navigation_handle_data->SetOptimizationGuideNavigationData( std::make_unique<OptimizationGuideNavigationData>( navigation_handle->GetNavigationId(), navigation_handle->NavigationStart())); navigation_data = navigation_handle_data->GetOptimizationGuideNavigationData(); } DCHECK(navigation_data); return navigation_data; } void OptimizationGuideWebContentsObserver::DidStartNavigation( content::NavigationHandle* navigation_handle) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!IsValidOptimizationGuideNavigation(navigation_handle)) return; if (!optimization_guide_keyed_service_) return; OptimizationGuideNavigationData* navigation_data = GetOrCreateOptimizationGuideNavigationData(navigation_handle); navigation_data->set_navigation_url(navigation_handle->GetURL()); optimization_guide_keyed_service_->OnNavigationStartOrRedirect( navigation_data); } void OptimizationGuideWebContentsObserver::DidRedirectNavigation( content::NavigationHandle* navigation_handle) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!IsValidOptimizationGuideNavigation(navigation_handle)) return; if (!optimization_guide_keyed_service_) return; OptimizationGuideNavigationData* navigation_data = GetOrCreateOptimizationGuideNavigationData(navigation_handle); navigation_data->set_navigation_url(navigation_handle->GetURL()); optimization_guide_keyed_service_->OnNavigationStartOrRedirect( navigation_data); } void OptimizationGuideWebContentsObserver::DidFinishNavigation( content::NavigationHandle* navigation_handle) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!IsValidOptimizationGuideNavigation(navigation_handle)) return; // Note that a lot of Navigations (same document, non-committed, etc.) might // not have navigation data associated with them, but we reduce likelihood of // future leaks by always trying to remove the data. NavigationHandleData* navigation_handle_data = NavigationHandleData::GetForNavigationHandle(*navigation_handle); if (!navigation_handle_data) return; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce( &OptimizationGuideWebContentsObserver::NotifyNavigationFinish, weak_factory_.GetWeakPtr(), navigation_handle_data->TakeOptimizationGuideNavigationData(), navigation_handle->GetRedirectChain())); } void OptimizationGuideWebContentsObserver::PostFetchHintsUsingManager( content::RenderFrameHost* render_frame_host) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!render_frame_host->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) return; if (!optimization_guide_keyed_service_) return; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce( &OptimizationGuideWebContentsObserver::FetchHintsUsingManager, weak_factory_.GetWeakPtr(), optimization_guide_keyed_service_->GetHintsManager(), web_contents()->GetPrimaryPage().GetWeakPtr())); } void OptimizationGuideWebContentsObserver::FetchHintsUsingManager( optimization_guide::ChromeHintsManager* hints_manager, base::WeakPtr<content::Page> page) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(hints_manager); if (!page) return; PageData& page_data = GetPageData(*page); page_data.set_sent_batched_hints_request(); hints_manager->FetchHintsForURLs( page_data.GetHintsTargetUrls(), optimization_guide::proto::CONTEXT_BATCH_UPDATE_GOOGLE_SRP); } void OptimizationGuideWebContentsObserver::NotifyNavigationFinish( std::unique_ptr<OptimizationGuideNavigationData> navigation_data, const std::vector<GURL>& navigation_redirect_chain) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (optimization_guide_keyed_service_) { optimization_guide_keyed_service_->OnNavigationFinish( navigation_redirect_chain); } // We keep the navigation data in the PageData around to keep track of events // happening for the navigation that can happen after commit, such as a fetch // for the navigation successfully completing (which is not guaranteed to come // back before commit, if at all). PageData& page_data = GetPageData(web_contents()->GetPrimaryPage()); page_data.SetNavigationData(std::move(navigation_data)); } void OptimizationGuideWebContentsObserver::FlushLastNavigationData() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); PageData& page_data = GetPageData(web_contents()->GetPrimaryPage()); page_data.SetNavigationData(nullptr); } void OptimizationGuideWebContentsObserver::AddURLsToBatchFetchBasedOnPrediction( std::vector<GURL> urls, content::WebContents* web_contents) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!this->web_contents()) return; DCHECK_EQ(this->web_contents(), web_contents); PageData& page_data = GetPageData(web_contents->GetPrimaryPage()); if (page_data.is_sent_batched_hints_request()) return; page_data.InsertHintTargetUrls(urls); PostFetchHintsUsingManager(web_contents->GetMainFrame()); } OptimizationGuideWebContentsObserver::PageData& OptimizationGuideWebContentsObserver::GetPageData(content::Page& page) { return *PageData::GetOrCreateForPage(page); } OptimizationGuideWebContentsObserver::PageData::PageData(content::Page& page) : PageUserData(page) {} OptimizationGuideWebContentsObserver::PageData::~PageData() = default; void OptimizationGuideWebContentsObserver::PageData::InsertHintTargetUrls( const std::vector<GURL>& urls) { DCHECK(!sent_batched_hints_request_); for (const GURL& url : urls) hints_target_urls_.insert(url); } std::vector<GURL> OptimizationGuideWebContentsObserver::PageData::GetHintsTargetUrls() { std::vector<GURL> target_urls = std::move(hints_target_urls_.vector());<|fim▁hole|>} OptimizationGuideWebContentsObserver::NavigationHandleData:: NavigationHandleData(content::NavigationHandle&) {} OptimizationGuideWebContentsObserver::NavigationHandleData:: ~NavigationHandleData() = default; PAGE_USER_DATA_KEY_IMPL(OptimizationGuideWebContentsObserver::PageData); NAVIGATION_HANDLE_USER_DATA_KEY_IMPL( OptimizationGuideWebContentsObserver::NavigationHandleData); WEB_CONTENTS_USER_DATA_KEY_IMPL(OptimizationGuideWebContentsObserver);<|fim▁end|>
hints_target_urls_.clear(); return target_urls;
<|file_name|>test_setup.rs<|end_file_name|><|fim▁begin|>use std::os::raw; use std::ptr; use std::sync::Once; static START: Once = Once::new(); type SECStatus = raw::c_int; const SEC_SUCCESS: SECStatus = 0; // TODO: ugh this will probably have a platform-specific name... #[link(name = "nss3")] extern "C" { fn NSS_NoDB_Init(configdir: *const u8) -> SECStatus; } pub fn setup() { START.call_once(|| { let null_ptr: *const u8 = ptr::null(); unsafe { assert_eq!(NSS_NoDB_Init(null_ptr), SEC_SUCCESS); } }); } #[cfg_attr(rustfmt, rustfmt_skip)] pub const PKCS8_P256_EE: [u8; 139] = [ 0x30, 0x81, 0x87, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x04, 0x6d, 0x30, 0x6b, 0x02, 0x01, 0x01, 0x04, 0x20, 0x21, 0x91, 0x40, 0x3d, 0x57, 0x10, 0xbf, 0x15, 0xa2, 0x65, 0x81, 0x8c, 0xd4, 0x2e, 0xd6, 0xfe, 0xdf, 0x09, 0xad, 0xd9, 0x2d, 0x78, 0xb1, 0x8e, 0x7a, 0x1e, 0x9f, 0xeb, 0x95, 0x52, 0x47, 0x02, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x4f, 0xbf, 0xbb, 0xbb, 0x61, 0xe0, 0xf8, 0xf9, 0xb1, 0xa6, 0x0a, 0x59, 0xac, 0x87, 0x04, 0xe2, 0xec, 0x05, 0x0b, 0x42, 0x3e, 0x3c, 0xf7, 0x2e, 0x92, 0x3f, 0x2c, 0x4f, 0x79, 0x4b, 0x45, 0x5c, 0x2a, 0x69, 0xd2, 0x33, 0x45, 0x6c, 0x36, 0xc4, 0x11, 0x9d, 0x07, 0x06, 0xe0, 0x0e, 0xed, 0xc8, 0xd1, 0x93, 0x90, 0xd7, 0x99, 0x1b, 0x7b, 0x2d, 0x07, 0xa3, 0x04, 0xea, 0xa0, 0x4a, 0xa6, 0xc0, 0x0a ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const P256_EE: [u8; 300] = [ 0x30, 0x82, 0x01, 0x28, 0x30, 0x81, 0xcf, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x2f, 0xc3, 0x5f, 0x05, 0x80, 0xb4, 0x49, 0x45, 0x13, 0x92, 0xd6, 0x93, 0xb7, 0x2d, 0x71, 0x19, 0xc5, 0x8c, 0x40, 0x39, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x69, 0x6e, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x65, 0x65, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4f, 0xbf, 0xbb, 0xbb, 0x61, 0xe0, 0xf8, 0xf9, 0xb1, 0xa6, 0x0a, 0x59, 0xac, 0x87, 0x04, 0xe2, 0xec, 0x05, 0x0b, 0x42, 0x3e, 0x3c, 0xf7, 0x2e, 0x92, 0x3f, 0x2c, 0x4f, 0x79, 0x4b, 0x45, 0x5c, 0x2a, 0x69, 0xd2, 0x33, 0x45, 0x6c, 0x36, 0xc4, 0x11, 0x9d, 0x07, 0x06, 0xe0, 0x0e, 0xed, 0xc8, 0xd1, 0x93, 0x90, 0xd7, 0x99, 0x1b, 0x7b, 0x2d, 0x07, 0xa3, 0x04, 0xea, 0xa0, 0x4a, 0xa6, 0xc0, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x5c, 0x75, 0x51, 0x9f, 0x13, 0x11, 0x50, 0xcd, 0x5d, 0x8a, 0xde, 0x20, 0xa3, 0xbc, 0x06, 0x30, 0x91, 0xff, 0xb2, 0x73, 0x75, 0x5f, 0x31, 0x64, 0xec, 0xfd, 0xcb, 0x42, 0x80, 0x0a, 0x70, 0xe6, 0x02, 0x21, 0x00, 0xff, 0x81, 0xbe, 0xa8, 0x0d, 0x03, 0x36, 0x6b, 0x75, 0xe2, 0x70, 0x6a, 0xac, 0x07, 0x2e, 0x4c, 0xdc, 0xf9, 0xc5, 0x89, 0xc1, 0xcf, 0x88, 0xc2, 0xc8, 0x2a, 0x32, 0xf5, 0x42, 0x0c, 0xfa, 0x0b ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const PKCS8_P384_EE: [u8; 185] = [ 0x30, 0x81, 0xb6, 0x02, 0x01, 0x00, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22, 0x04, 0x81, 0x9e, 0x30, 0x81, 0x9b, 0x02, 0x01, 0x01, 0x04, 0x30, 0x03, 0x5c, 0x7a, 0x1b, 0x10, 0xd9, 0xfa, 0xfe, 0x83, 0x7b, 0x64, 0xad, 0x92, 0xf2, 0x2f, 0x5c, 0xed, 0x07, 0x89, 0x18, 0x65, 0x38, 0x66, 0x9b, 0x5c, 0x6d, 0x87, 0x2c, 0xec, 0x3d, 0x92, 0x61, 0x22, 0xb3, 0x93, 0x77, 0x2b, 0x57, 0x60, 0x2f, 0xf3, 0x13, 0x65, 0xef, 0xe1, 0x39, 0x32, 0x46, 0xa1, 0x64, 0x03, 0x62, 0x00, 0x04, 0xa1, 0x68, 0x72, 0x43, 0x36, 0x2b, 0x5c, 0x7b, 0x18, 0x89, 0xf3, 0x79, 0x15, 0x46, 0x15, 0xa1, 0xc7, 0x3f, 0xb4, 0x8d, 0xee, 0x86, 0x3e, 0x02, 0x29, 0x15, 0xdb, 0x60, 0x8e, 0x25, 0x2d, 0xe4, 0xb7, 0x13, 0x2d, 0xa8, 0xce, 0x98, 0xe8, 0x31, 0x53, 0x4e, 0x6a, 0x9c, 0x0c, 0x0b, 0x09, 0xc8, 0xd6, 0x39, 0xad, 0xe8, 0x32, 0x06, 0xe5, 0xba, 0x81, 0x34, 0x73, 0xa1, 0x1f, 0xa3, 0x30, 0xe0, 0x5d, 0xa8, 0xc9, 0x6e, 0x43, 0x83, 0xfe, 0x27, 0x87, 0x3d, 0xa9, 0x71, 0x03, 0xbe, 0x28, 0x88, 0xcf, 0xf0, 0x02, 0xf0, 0x5a, 0xf7, 0x1a, 0x1f, 0xdd, 0xcc, 0x83, 0x74, 0xaa, 0x6e, 0xa9, 0xce ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const PKCS8_P521_EE: [u8; 240] = [ 0x30, 0x81, 0xed, 0x02, 0x01, 0x00, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x23, 0x04, 0x81, 0xd5, 0x30, 0x81, 0xd2, 0x02, 0x01, 0x01, 0x04, 0x42, 0x01, 0x4f, 0x32, 0x84, 0xfa, 0x69, 0x8d, 0xd9, 0xfe, 0x11, 0x18, 0xdd, 0x33, 0x18, 0x51, 0xcd, 0xfa, 0xac, 0x5a, 0x38, 0x29, 0x27, 0x8e, 0xb8, 0x99, 0x48, 0x39, 0xde, 0x94, 0x71, 0xc9, 0x40, 0xb8, 0x58, 0xc6, 0x9d, 0x2d, 0x05, 0xe8, 0xc0, 0x17, 0x88, 0xa7, 0xd0, 0xb6, 0xe2, 0x35, 0xaa, 0x5e, 0x78, 0x3f, 0xc1, 0xbe, 0xe8, 0x07, 0xdc, 0xc3, 0x86, 0x5f, 0x92, 0x0e, 0x12, 0xcf, 0x8f, 0x2d, 0x29, 0xa1, 0x81, 0x88, 0x03, 0x81, 0x85, 0x00,<|fim▁hole|> 0x3b, 0x69, 0x4f, 0x21, 0x3f, 0x8c, 0x31, 0x21, 0xf8, 0x6d, 0xc9, 0x7a, 0x04, 0xe5, 0xa7, 0x16, 0x7d, 0xb4, 0xe5, 0xbc, 0xd3, 0x71, 0x12, 0x3d, 0x46, 0xe4, 0x5d, 0xb6, 0xb5, 0xd5, 0x37, 0x0a, 0x7f, 0x20, 0xfb, 0x63, 0x31, 0x55, 0xd3, 0x8f, 0xfa, 0x16, 0xd2, 0xbd, 0x76, 0x1d, 0xca, 0xc4, 0x74, 0xb9, 0xa2, 0xf5, 0x02, 0x3a, 0x40, 0x49, 0x31, 0x01, 0xc9, 0x62, 0xcd, 0x4d, 0x2f, 0xdd, 0xf7, 0x82, 0x28, 0x5e, 0x64, 0x58, 0x41, 0x39, 0xc2, 0xf9, 0x1b, 0x47, 0xf8, 0x7f, 0xf8, 0x23, 0x54, 0xd6, 0x63, 0x0f, 0x74, 0x6a, 0x28, 0xa0, 0xdb, 0x25, 0x74, 0x1b, 0x5b, 0x34, 0xa8, 0x28, 0x00, 0x8b, 0x22, 0xac, 0xc2, 0x3f, 0x92, 0x4f, 0xaa, 0xfb, 0xd4, 0xd3, 0x3f, 0x81, 0xea, 0x66, 0x95, 0x6d, 0xfe, 0xaa, 0x2b, 0xfd, 0xfc, 0xf5 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const P521_EE: [u8; 367] = [ 0x30, 0x82, 0x01, 0x6b, 0x30, 0x82, 0x01, 0x12, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x49, 0xdb, 0x7d, 0xec, 0x87, 0x2b, 0x95, 0xfc, 0xfb, 0x57, 0xfb, 0xc8, 0xd5, 0x57, 0xb7, 0x3a, 0x10, 0xcc, 0xf1, 0x7a, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x69, 0x6e, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x65, 0x65, 0x2d, 0x70, 0x35, 0x32, 0x31, 0x30, 0x81, 0x9b, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x23, 0x03, 0x81, 0x86, 0x00, 0x04, 0x01, 0x4c, 0xdc, 0x9c, 0xac, 0xc4, 0x79, 0x41, 0x09, 0x6b, 0xc9, 0xcc, 0x66, 0x75, 0x2e, 0xc2, 0x7f, 0x59, 0x77, 0x34, 0xfa, 0x66, 0xc6, 0x2b, 0x79, 0x2f, 0x88, 0xc5, 0x19, 0xd6, 0xd3, 0x7f, 0x0d, 0x16, 0xea, 0x1c, 0x48, 0x3a, 0x18, 0x27, 0xa0, 0x10, 0xb9, 0x12, 0x8e, 0x3a, 0x08, 0x07, 0x0c, 0xa3, 0x3e, 0xf5, 0xf5, 0x78, 0x35, 0xb7, 0xc1, 0xba, 0x25, 0x1f, 0x6c, 0xc3, 0x52, 0x1d, 0xc4, 0x2b, 0x01, 0x06, 0x53, 0x45, 0x19, 0x81, 0xb4, 0x45, 0xd3, 0x43, 0xee, 0xd3, 0x78, 0x2a, 0x35, 0xd6, 0xcf, 0xf0, 0xff, 0x48, 0x4f, 0x5a, 0x88, 0x3d, 0x20, 0x9f, 0x1b, 0x90, 0x42, 0xb7, 0x26, 0x70, 0x35, 0x68, 0xb2, 0xf3, 0x26, 0xe1, 0x8b, 0x83, 0x3b, 0xdd, 0x8a, 0xa0, 0x73, 0x43, 0x92, 0xbc, 0xd1, 0x95, 0x01, 0xe1, 0x0d, 0x69, 0x8a, 0x79, 0xf5, 0x3e, 0x11, 0xe0, 0xa2, 0x2b, 0xdd, 0x2a, 0xad, 0x90, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0x5c, 0x75, 0x51, 0x9f, 0x13, 0x11, 0x50, 0xcd, 0x5d, 0x8a, 0xde, 0x20, 0xa3, 0xbc, 0x06, 0x30, 0x91, 0xff, 0xb2, 0x73, 0x75, 0x5f, 0x31, 0x64, 0xec, 0xfd, 0xcb, 0x42, 0x80, 0x0a, 0x70, 0xe6, 0x02, 0x20, 0x35, 0x20, 0x7c, 0xff, 0x51, 0xf6, 0x68, 0xce, 0x1d, 0x00, 0xf9, 0xcc, 0x7f, 0xa7, 0xbc, 0x79, 0x52, 0xea, 0x56, 0xdf, 0xc1, 0x46, 0x7c, 0x0c, 0xa1, 0x2e, 0x32, 0xb1, 0x69, 0x4b, 0x20, 0xc4 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const P384_EE: [u8; 329] = [ 0x30, 0x82, 0x01, 0x45, 0x30, 0x81, 0xec, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x79, 0xe3, 0x1c, 0x60, 0x97, 0xa4, 0x3c, 0x3b, 0x82, 0x11, 0x42, 0x37, 0xaf, 0x57, 0x05, 0xa8, 0xde, 0xd3, 0x40, 0x58, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x69, 0x6e, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x65, 0x65, 0x2d, 0x70, 0x33, 0x38, 0x34, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xa1, 0x68, 0x72, 0x43, 0x36, 0x2b, 0x5c, 0x7b, 0x18, 0x89, 0xf3, 0x79, 0x15, 0x46, 0x15, 0xa1, 0xc7, 0x3f, 0xb4, 0x8d, 0xee, 0x86, 0x3e, 0x02, 0x29, 0x15, 0xdb, 0x60, 0x8e, 0x25, 0x2d, 0xe4, 0xb7, 0x13, 0x2d, 0xa8, 0xce, 0x98, 0xe8, 0x31, 0x53, 0x4e, 0x6a, 0x9c, 0x0c, 0x0b, 0x09, 0xc8, 0xd6, 0x39, 0xad, 0xe8, 0x32, 0x06, 0xe5, 0xba, 0x81, 0x34, 0x73, 0xa1, 0x1f, 0xa3, 0x30, 0xe0, 0x5d, 0xa8, 0xc9, 0x6e, 0x43, 0x83, 0xfe, 0x27, 0x87, 0x3d, 0xa9, 0x71, 0x03, 0xbe, 0x28, 0x88, 0xcf, 0xf0, 0x02, 0xf0, 0x5a, 0xf7, 0x1a, 0x1f, 0xdd, 0xcc, 0x83, 0x74, 0xaa, 0x6e, 0xa9, 0xce, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x5c, 0x75, 0x51, 0x9f, 0x13, 0x11, 0x50, 0xcd, 0x5d, 0x8a, 0xde, 0x20, 0xa3, 0xbc, 0x06, 0x30, 0x91, 0xff, 0xb2, 0x73, 0x75, 0x5f, 0x31, 0x64, 0xec, 0xfd, 0xcb, 0x42, 0x80, 0x0a, 0x70, 0xe6, 0x02, 0x21, 0x00, 0xf3, 0x04, 0x26, 0xf2, 0xfd, 0xbc, 0x89, 0x3f, 0x29, 0x3b, 0x70, 0xbc, 0x72, 0xa6, 0xc2, 0x23, 0xcc, 0x43, 0x4d, 0x84, 0x71, 0xaf, 0x53, 0xe4, 0x4b, 0x3e, 0xc0, 0xbf, 0xe5, 0x68, 0x86, 0x49 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const P256_INT: [u8; 332] = [ 0x30, 0x82, 0x01, 0x48, 0x30, 0x81, 0xf0, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x43, 0x63, 0x59, 0xad, 0x04, 0x34, 0x56, 0x80, 0x43, 0xec, 0x90, 0x6a, 0xd4, 0x10, 0x64, 0x7c, 0x7f, 0x38, 0x32, 0xe2, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x69, 0x6e, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4f, 0xbf, 0xbb, 0xbb, 0x61, 0xe0, 0xf8, 0xf9, 0xb1, 0xa6, 0x0a, 0x59, 0xac, 0x87, 0x04, 0xe2, 0xec, 0x05, 0x0b, 0x42, 0x3e, 0x3c, 0xf7, 0x2e, 0x92, 0x3f, 0x2c, 0x4f, 0x79, 0x4b, 0x45, 0x5c, 0x2a, 0x69, 0xd2, 0x33, 0x45, 0x6c, 0x36, 0xc4, 0x11, 0x9d, 0x07, 0x06, 0xe0, 0x0e, 0xed, 0xc8, 0xd1, 0x93, 0x90, 0xd7, 0x99, 0x1b, 0x7b, 0x2d, 0x07, 0xa3, 0x04, 0xea, 0xa0, 0x4a, 0xa6, 0xc0, 0xa3, 0x1d, 0x30, 0x1b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0x63, 0x59, 0x02, 0x01, 0x89, 0xd7, 0x3e, 0x5b, 0xff, 0xd1, 0x16, 0x4e, 0xe3, 0xe2, 0x0a, 0xe0, 0x4a, 0xd8, 0x75, 0xaf, 0x77, 0x5c, 0x93, 0x60, 0xba, 0x10, 0x1f, 0x97, 0xdd, 0x27, 0x2d, 0x24, 0x02, 0x20, 0x3d, 0x87, 0x0f, 0xac, 0x22, 0x4d, 0x16, 0xd9, 0xa1, 0x95, 0xbb, 0x56, 0xe0, 0x21, 0x05, 0x93, 0xd1, 0x07, 0xb5, 0x25, 0x3b, 0xf4, 0x57, 0x20, 0x87, 0x13, 0xa2, 0xf7, 0x78, 0x15, 0x30, 0xa7 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const P256_ROOT: [u8; 334] = [ 0x30, 0x82, 0x01, 0x4a, 0x30, 0x81, 0xf1, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x5f, 0x3f, 0xae, 0x90, 0x49, 0x30, 0x2f, 0x33, 0x6e, 0x95, 0x23, 0xa7, 0xcb, 0x23, 0xd7, 0x65, 0x4f, 0xea, 0x3c, 0xf7, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x70, 0x32, 0x35, 0x36, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4f, 0xbf, 0xbb, 0xbb, 0x61, 0xe0, 0xf8, 0xf9, 0xb1, 0xa6, 0x0a, 0x59, 0xac, 0x87, 0x04, 0xe2, 0xec, 0x05, 0x0b, 0x42, 0x3e, 0x3c, 0xf7, 0x2e, 0x92, 0x3f, 0x2c, 0x4f, 0x79, 0x4b, 0x45, 0x5c, 0x2a, 0x69, 0xd2, 0x33, 0x45, 0x6c, 0x36, 0xc4, 0x11, 0x9d, 0x07, 0x06, 0xe0, 0x0e, 0xed, 0xc8, 0xd1, 0x93, 0x90, 0xd7, 0x99, 0x1b, 0x7b, 0x2d, 0x07, 0xa3, 0x04, 0xea, 0xa0, 0x4a, 0xa6, 0xc0, 0xa3, 0x1d, 0x30, 0x1b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x5c, 0x75, 0x51, 0x9f, 0x13, 0x11, 0x50, 0xcd, 0x5d, 0x8a, 0xde, 0x20, 0xa3, 0xbc, 0x06, 0x30, 0x91, 0xff, 0xb2, 0x73, 0x75, 0x5f, 0x31, 0x64, 0xec, 0xfd, 0xcb, 0x42, 0x80, 0x0a, 0x70, 0xe6, 0x02, 0x21, 0x00, 0xc2, 0xe4, 0xc1, 0xa8, 0xe2, 0x89, 0xdc, 0xa1, 0xbb, 0xe7, 0xd5, 0x4f, 0x5c, 0x88, 0xad, 0xeb, 0xa4, 0x78, 0xa1, 0x19, 0xbe, 0x22, 0x54, 0xc8, 0x9f, 0xef, 0xb8, 0x5d, 0xa2, 0x40, 0xd9, 0x8b ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const PKCS8_RSA_EE: [u8; 1218] = [ 0x30, 0x82, 0x04, 0xbe, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x04, 0xa8, 0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xba, 0x88, 0x51, 0xa8, 0x44, 0x8e, 0x16, 0xd6, 0x41, 0xfd, 0x6e, 0xb6, 0x88, 0x06, 0x36, 0x10, 0x3d, 0x3c, 0x13, 0xd9, 0xea, 0xe4, 0x35, 0x4a, 0xb4, 0xec, 0xf5, 0x68, 0x57, 0x6c, 0x24, 0x7b, 0xc1, 0xc7, 0x25, 0xa8, 0xe0, 0xd8, 0x1f, 0xbd, 0xb1, 0x9c, 0x06, 0x9b, 0x6e, 0x1a, 0x86, 0xf2, 0x6b, 0xe2, 0xaf, 0x5a, 0x75, 0x6b, 0x6a, 0x64, 0x71, 0x08, 0x7a, 0xa5, 0x5a, 0xa7, 0x45, 0x87, 0xf7, 0x1c, 0xd5, 0x24, 0x9c, 0x02, 0x7e, 0xcd, 0x43, 0xfc, 0x1e, 0x69, 0xd0, 0x38, 0x20, 0x29, 0x93, 0xab, 0x20, 0xc3, 0x49, 0xe4, 0xdb, 0xb9, 0x4c, 0xc2, 0x6b, 0x6c, 0x0e, 0xed, 0x15, 0x82, 0x0f, 0xf1, 0x7e, 0xad, 0x69, 0x1a, 0xb1, 0xd3, 0x02, 0x3a, 0x8b, 0x2a, 0x41, 0xee, 0xa7, 0x70, 0xe0, 0x0f, 0x0d, 0x8d, 0xfd, 0x66, 0x0b, 0x2b, 0xb0, 0x24, 0x92, 0xa4, 0x7d, 0xb9, 0x88, 0x61, 0x79, 0x90, 0xb1, 0x57, 0x90, 0x3d, 0xd2, 0x3b, 0xc5, 0xe0, 0xb8, 0x48, 0x1f, 0xa8, 0x37, 0xd3, 0x88, 0x43, 0xef, 0x27, 0x16, 0xd8, 0x55, 0xb7, 0x66, 0x5a, 0xaa, 0x7e, 0x02, 0x90, 0x2f, 0x3a, 0x7b, 0x10, 0x80, 0x06, 0x24, 0xcc, 0x1c, 0x6c, 0x97, 0xad, 0x96, 0x61, 0x5b, 0xb7, 0xe2, 0x96, 0x12, 0xc0, 0x75, 0x31, 0xa3, 0x0c, 0x91, 0xdd, 0xb4, 0xca, 0xf7, 0xfc, 0xad, 0x1d, 0x25, 0xd3, 0x09, 0xef, 0xb9, 0x17, 0x0e, 0xa7, 0x68, 0xe1, 0xb3, 0x7b, 0x2f, 0x22, 0x6f, 0x69, 0xe3, 0xb4, 0x8a, 0x95, 0x61, 0x1d, 0xee, 0x26, 0xd6, 0x25, 0x9d, 0xab, 0x91, 0x08, 0x4e, 0x36, 0xcb, 0x1c, 0x24, 0x04, 0x2c, 0xbf, 0x16, 0x8b, 0x2f, 0xe5, 0xf1, 0x8f, 0x99, 0x17, 0x31, 0xb8, 0xb3, 0xfe, 0x49, 0x23, 0xfa, 0x72, 0x51, 0xc4, 0x31, 0xd5, 0x03, 0xac, 0xda, 0x18, 0x0a, 0x35, 0xed, 0x8d, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x01, 0x00, 0x9e, 0xcb, 0xce, 0x38, 0x61, 0xa4, 0x54, 0xec, 0xb1, 0xe0, 0xfe, 0x8f, 0x85, 0xdd, 0x43, 0xc9, 0x2f, 0x58, 0x25, 0xce, 0x2e, 0x99, 0x78, 0x84, 0xd0, 0xe1, 0xa9, 0x49, 0xda, 0xa2, 0xc5, 0xac, 0x55, 0x9b, 0x24, 0x04, 0x50, 0xe5, 0xac, 0x9f, 0xe0, 0xc3, 0xe3, 0x1c, 0x0e, 0xef, 0xa6, 0x52, 0x5a, 0x65, 0xf0, 0xc2, 0x21, 0x94, 0x00, 0x4e, 0xe1, 0xab, 0x46, 0x3d, 0xde, 0x9e, 0xe8, 0x22, 0x87, 0xcc, 0x93, 0xe7, 0x46, 0xa9, 0x19, 0x29, 0xc5, 0xe6, 0xac, 0x3d, 0x88, 0x75, 0x3f, 0x6c, 0x25, 0xba, 0x59, 0x79, 0xe7, 0x3e, 0x5d, 0x8f, 0xb2, 0x39, 0x11, 0x1a, 0x3c, 0xda, 0xb8, 0xa4, 0xb0, 0xcd, 0xf5, 0xf9, 0xca, 0xb0, 0x5f, 0x12, 0x33, 0xa3, 0x83, 0x35, 0xc6, 0x4b, 0x55, 0x60, 0x52, 0x5e, 0x7e, 0x3b, 0x92, 0xad, 0x7c, 0x75, 0x04, 0xcf, 0x1d, 0xc7, 0xcb, 0x00, 0x57, 0x88, 0xaf, 0xcb, 0xe1, 0xe8, 0xf9, 0x5d, 0xf7, 0x40, 0x2a, 0x15, 0x15, 0x30, 0xd5, 0x80, 0x83, 0x46, 0x86, 0x4e, 0xb3, 0x70, 0xaa, 0x79, 0x95, 0x6a, 0x58, 0x78, 0x62, 0xcb, 0x53, 0x37, 0x91, 0x30, 0x7f, 0x70, 0xd9, 0x1c, 0x96, 0xd2, 0x2d, 0x00, 0x1a, 0x69, 0x00, 0x9b, 0x92, 0x3c, 0x68, 0x33, 0x88, 0xc9, 0xf3, 0x6c, 0xb9, 0xb5, 0xeb, 0xe6, 0x43, 0x02, 0x04, 0x1c, 0x78, 0xd9, 0x08, 0x20, 0x6b, 0x87, 0x00, 0x9c, 0xb8, 0xca, 0xba, 0xca, 0xd3, 0xdb, 0xdb, 0x27, 0x92, 0xfb, 0x91, 0x1b, 0x2c, 0xf4, 0xdb, 0x66, 0x03, 0x58, 0x5b, 0xe9, 0xae, 0x0c, 0xa3, 0xb8, 0xe6, 0x41, 0x7a, 0xa0, 0x4b, 0x06, 0xe4, 0x70, 0xea, 0x1a, 0x3b, 0x58, 0x1c, 0xa0, 0x3a, 0x67, 0x81, 0xc9, 0x31, 0x5b, 0x62, 0xb3, 0x0e, 0x60, 0x11, 0xf2, 0x24, 0x72, 0x59, 0x46, 0xee, 0xc5, 0x7c, 0x6d, 0x94, 0x41, 0x02, 0x81, 0x81, 0x00, 0xdd, 0x6e, 0x1d, 0x4f, 0xff, 0xeb, 0xf6, 0x8d, 0x88, 0x9c, 0x4d, 0x11, 0x4c, 0xda, 0xaa, 0x9c, 0xaa, 0x63, 0xa5, 0x93, 0x74, 0x28, 0x6c, 0x8a, 0x5c, 0x29, 0xa7, 0x17, 0xbb, 0xa6, 0x03, 0x75, 0x64, 0x4d, 0x5c, 0xaa, 0x67, 0x4c, 0x4b, 0x8b, 0xc7, 0x32, 0x63, 0x58, 0x64, 0x62, 0x20, 0xe4, 0x55, 0x0d, 0x76, 0x08, 0xac, 0x27, 0xd5, 0x5b, 0x6d, 0xb7, 0x4f, 0x8d, 0x81, 0x27, 0xef, 0x8f, 0xa0, 0x90, 0x98, 0xb6, 0x91, 0x47, 0xde, 0x06, 0x55, 0x73, 0x44, 0x7e, 0x18, 0x3d, 0x22, 0xfe, 0x7d, 0x88, 0x5a, 0xce, 0xb5, 0x13, 0xd9, 0x58, 0x1d, 0xd5, 0xe0, 0x7c, 0x1a, 0x90, 0xf5, 0xce, 0x08, 0x79, 0xde, 0x13, 0x13, 0x71, 0xec, 0xef, 0xc9, 0xce, 0x72, 0xe9, 0xc4, 0x3d, 0xc1, 0x27, 0xd2, 0x38, 0x19, 0x0d, 0xe8, 0x11, 0x77, 0x3c, 0xa5, 0xd1, 0x93, 0x01, 0xf4, 0x8c, 0x74, 0x2b, 0x02, 0x81, 0x81, 0x00, 0xd7, 0xa7, 0x73, 0xd9, 0xeb, 0xc3, 0x80, 0xa7, 0x67, 0xd2, 0xfe, 0xc0, 0x93, 0x4a, 0xd4, 0xe8, 0xb5, 0x66, 0x72, 0x40, 0x77, 0x1a, 0xcd, 0xeb, 0xb5, 0xad, 0x79, 0x6f, 0x47, 0x8f, 0xec, 0x4d, 0x45, 0x98, 0x5e, 0xfb, 0xc9, 0x53, 0x29, 0x68, 0x28, 0x9c, 0x8d, 0x89, 0x10, 0x2f, 0xad, 0xf2, 0x1f, 0x34, 0xe2, 0xdd, 0x49, 0x40, 0xeb, 0xa8, 0xc0, 0x9d, 0x6d, 0x1f, 0x16, 0xdc, 0xc2, 0x97, 0x29, 0x77, 0x4c, 0x43, 0x27, 0x5e, 0x92, 0x51, 0xdd, 0xbe, 0x49, 0x09, 0xe1, 0xfd, 0x3b, 0xf1, 0xe4, 0xbe, 0xdf, 0x46, 0xa3, 0x9b, 0x8b, 0x38, 0x33, 0x28, 0xef, 0x4a, 0xe3, 0xb9, 0x5b, 0x92, 0xf2, 0x07, 0x0a, 0xf2, 0x6c, 0x9e, 0x7c, 0x5c, 0x9b, 0x58, 0x7f, 0xed, 0xde, 0x05, 0xe8, 0xe7, 0xd8, 0x6c, 0xa5, 0x78, 0x86, 0xfb, 0x16, 0x58, 0x10, 0xa7, 0x7b, 0x98, 0x45, 0xbc, 0x31, 0x27, 0x02, 0x81, 0x81, 0x00, 0x96, 0x47, 0x2b, 0x41, 0xa6, 0x10, 0xc0, 0xad, 0xe1, 0xaf, 0x22, 0x66, 0xc1, 0x60, 0x0e, 0x36, 0x71, 0x35, 0x5b, 0xa4, 0x2d, 0x4b, 0x5a, 0x0e, 0xb4, 0xe9, 0xd7, 0xeb, 0x35, 0x81, 0x40, 0x0b, 0xa5, 0xdd, 0x13, 0x2c, 0xdb, 0x1a, 0x5e, 0x93, 0x28, 0xc7, 0xbb, 0xc0, 0xbb, 0xb0, 0x15, 0x5e, 0xa1, 0x92, 0x97, 0x2e, 0xdf, 0x97, 0xd1, 0x27, 0x51, 0xd8, 0xfc, 0xf6, 0xae, 0x57, 0x2a, 0x30, 0xb1, 0xea, 0x30, 0x9a, 0x87, 0x12, 0xdd, 0x4e, 0x33, 0x24, 0x1d, 0xb1, 0xee, 0x45, 0x5f, 0xc0, 0x93, 0xf5, 0xbc, 0x9b, 0x59, 0x2d, 0x75, 0x6e, 0x66, 0x21, 0x47, 0x4f, 0x32, 0xc0, 0x7a, 0xf2, 0x2f, 0xb2, 0x75, 0xd3, 0x40, 0x79, 0x2b, 0x32, 0xba, 0x25, 0x90, 0xbb, 0xb2, 0x61, 0xae, 0xfb, 0x95, 0xa2, 0x58, 0xee, 0xa5, 0x37, 0x65, 0x53, 0x15, 0xbe, 0x9c, 0x24, 0xd1, 0x91, 0x99, 0x2d, 0x02, 0x81, 0x80, 0x28, 0xb4, 0x50, 0xa7, 0xa7, 0x5a, 0x85, 0x64, 0x13, 0xb2, 0xbd, 0xa6, 0xf7, 0xa6, 0x3e, 0x3d, 0x96, 0x4f, 0xb9, 0xec, 0xf5, 0x0e, 0x38, 0x23, 0xef, 0x6c, 0xc8, 0xe8, 0xfa, 0x26, 0xee, 0x41, 0x3f, 0x8b, 0x9d, 0x12, 0x05, 0x54, 0x0f, 0x12, 0xbb, 0xe7, 0xa0, 0xc7, 0x68, 0x28, 0xb7, 0xba, 0x65, 0xad, 0x83, 0xcc, 0xa4, 0xd0, 0xfe, 0x2a, 0x22, 0x01, 0x14, 0xe1, 0xb3, 0x5d, 0x03, 0xd5, 0xa8, 0x5b, 0xfe, 0x27, 0x06, 0xbd, 0x50, 0xfc, 0xe6, 0xcf, 0xcd, 0xd5, 0x71, 0xb4, 0x6c, 0xa6, 0x21, 0xb8, 0xed, 0x47, 0xd6, 0x05, 0xbb, 0xe7, 0x65, 0xb0, 0xaa, 0x4a, 0x06, 0x65, 0xac, 0x25, 0x36, 0x4d, 0xa2, 0x01, 0x54, 0x03, 0x2e, 0x12, 0x04, 0xb8, 0x55, 0x9d, 0x3e, 0x34, 0xfb, 0x5b, 0x17, 0x7c, 0x9a, 0x56, 0xff, 0x93, 0x51, 0x0a, 0x5a, 0x4a, 0x62, 0x87, 0xc1, 0x51, 0xde, 0x2d, 0x02, 0x81, 0x80, 0x28, 0x06, 0x7b, 0x93, 0x55, 0x80, 0x1d, 0x2e, 0xf5, 0x2d, 0xfa, 0x96, 0xd8, 0xad, 0xb5, 0x89, 0x67, 0x3c, 0xf8, 0xee, 0x8a, 0x9c, 0x6f, 0xf7, 0x2a, 0xee, 0xab, 0xe9, 0xef, 0x6b, 0xe5, 0x8a, 0x4f, 0x4a, 0xbf, 0x05, 0xf7, 0x88, 0x94, 0x7d, 0xc8, 0x51, 0xfd, 0xaa, 0x34, 0x54, 0x21, 0x47, 0xa7, 0x1a, 0x24, 0x6b, 0xfb, 0x05, 0x4e, 0xe7, 0x6a, 0xa3, 0x46, 0xab, 0xcd, 0x26, 0x92, 0xcf, 0xc9, 0xe4, 0x4c, 0x51, 0xe6, 0xf0, 0x69, 0xc7, 0x35, 0xe0, 0x73, 0xba, 0x01, 0x9f, 0x6a, 0x72, 0x14, 0x96, 0x1c, 0x91, 0xb2, 0x68, 0x71, 0xca, 0xea, 0xbf, 0x8f, 0x06, 0x44, 0x18, 0xa0, 0x26, 0x90, 0xe3, 0x9a, 0x8d, 0x5f, 0xf3, 0x06, 0x7b, 0x7c, 0xdb, 0x7f, 0x50, 0xb1, 0xf5, 0x34, 0x18, 0xa7, 0x03, 0x96, 0x6c, 0x4f, 0xc7, 0x74, 0xbf, 0x74, 0x02, 0xaf, 0x6c, 0x43, 0x24, 0x7f, 0x43 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const RSA_EE: [u8; 691] = [ 0x30, 0x82, 0x02, 0xaf, 0x30, 0x82, 0x01, 0x99, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x07, 0x1c, 0x3b, 0x71, 0x08, 0xbe, 0xd7, 0x9f, 0xfd, 0xaf, 0x26, 0xb6, 0x08, 0xa3, 0x99, 0x06, 0x77, 0x69, 0x32, 0x7e, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x69, 0x6e, 0x74, 0x2d, 0x72, 0x73, 0x61, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x11, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x06, 0x65, 0x65, 0x2d, 0x72, 0x73, 0x61, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xba, 0x88, 0x51, 0xa8, 0x44, 0x8e, 0x16, 0xd6, 0x41, 0xfd, 0x6e, 0xb6, 0x88, 0x06, 0x36, 0x10, 0x3d, 0x3c, 0x13, 0xd9, 0xea, 0xe4, 0x35, 0x4a, 0xb4, 0xec, 0xf5, 0x68, 0x57, 0x6c, 0x24, 0x7b, 0xc1, 0xc7, 0x25, 0xa8, 0xe0, 0xd8, 0x1f, 0xbd, 0xb1, 0x9c, 0x06, 0x9b, 0x6e, 0x1a, 0x86, 0xf2, 0x6b, 0xe2, 0xaf, 0x5a, 0x75, 0x6b, 0x6a, 0x64, 0x71, 0x08, 0x7a, 0xa5, 0x5a, 0xa7, 0x45, 0x87, 0xf7, 0x1c, 0xd5, 0x24, 0x9c, 0x02, 0x7e, 0xcd, 0x43, 0xfc, 0x1e, 0x69, 0xd0, 0x38, 0x20, 0x29, 0x93, 0xab, 0x20, 0xc3, 0x49, 0xe4, 0xdb, 0xb9, 0x4c, 0xc2, 0x6b, 0x6c, 0x0e, 0xed, 0x15, 0x82, 0x0f, 0xf1, 0x7e, 0xad, 0x69, 0x1a, 0xb1, 0xd3, 0x02, 0x3a, 0x8b, 0x2a, 0x41, 0xee, 0xa7, 0x70, 0xe0, 0x0f, 0x0d, 0x8d, 0xfd, 0x66, 0x0b, 0x2b, 0xb0, 0x24, 0x92, 0xa4, 0x7d, 0xb9, 0x88, 0x61, 0x79, 0x90, 0xb1, 0x57, 0x90, 0x3d, 0xd2, 0x3b, 0xc5, 0xe0, 0xb8, 0x48, 0x1f, 0xa8, 0x37, 0xd3, 0x88, 0x43, 0xef, 0x27, 0x16, 0xd8, 0x55, 0xb7, 0x66, 0x5a, 0xaa, 0x7e, 0x02, 0x90, 0x2f, 0x3a, 0x7b, 0x10, 0x80, 0x06, 0x24, 0xcc, 0x1c, 0x6c, 0x97, 0xad, 0x96, 0x61, 0x5b, 0xb7, 0xe2, 0x96, 0x12, 0xc0, 0x75, 0x31, 0xa3, 0x0c, 0x91, 0xdd, 0xb4, 0xca, 0xf7, 0xfc, 0xad, 0x1d, 0x25, 0xd3, 0x09, 0xef, 0xb9, 0x17, 0x0e, 0xa7, 0x68, 0xe1, 0xb3, 0x7b, 0x2f, 0x22, 0x6f, 0x69, 0xe3, 0xb4, 0x8a, 0x95, 0x61, 0x1d, 0xee, 0x26, 0xd6, 0x25, 0x9d, 0xab, 0x91, 0x08, 0x4e, 0x36, 0xcb, 0x1c, 0x24, 0x04, 0x2c, 0xbf, 0x16, 0x8b, 0x2f, 0xe5, 0xf1, 0x8f, 0x99, 0x17, 0x31, 0xb8, 0xb3, 0xfe, 0x49, 0x23, 0xfa, 0x72, 0x51, 0xc4, 0x31, 0xd5, 0x03, 0xac, 0xda, 0x18, 0x0a, 0x35, 0xed, 0x8d, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x03, 0x82, 0x01, 0x01, 0x00, 0x44, 0x92, 0xbb, 0x8e, 0x83, 0x58, 0x56, 0x2e, 0x7a, 0x86, 0xfa, 0x1d, 0x77, 0x50, 0x3f, 0x45, 0x8d, 0x90, 0xc4, 0x62, 0x27, 0x21, 0x96, 0x5a, 0xef, 0x51, 0x78, 0xd7, 0x7d, 0x0d, 0x02, 0x2d, 0x5a, 0x0e, 0x3c, 0x82, 0x6f, 0x1d, 0x92, 0x87, 0xd5, 0x1a, 0x44, 0xae, 0xa7, 0x92, 0xd1, 0x8b, 0xfa, 0x16, 0x53, 0x7f, 0xa3, 0x22, 0x96, 0x1a, 0x51, 0x8c, 0xeb, 0xa1, 0xe6, 0xf6, 0x37, 0x11, 0xfe, 0x7d, 0x53, 0x3f, 0xae, 0xf0, 0x6b, 0xb9, 0xb1, 0x7a, 0x73, 0x07, 0x14, 0xcf, 0x04, 0x05, 0x93, 0x9e, 0xe3, 0xd2, 0x4d, 0x9d, 0x6d, 0x35, 0x68, 0xf9, 0x36, 0xe5, 0x10, 0x0a, 0x36, 0xd9, 0x48, 0xb0, 0x83, 0xd0, 0xb9, 0x58, 0x74, 0x53, 0xb3, 0xbc, 0x99, 0xab, 0xe1, 0x3e, 0xd5, 0x01, 0x8e, 0xcf, 0x3a, 0x69, 0x93, 0x9e, 0xa7, 0x88, 0xd4, 0xad, 0x95, 0xf9, 0x2a, 0xb4, 0x7f, 0x95, 0x97, 0x86, 0x50, 0x38, 0xb1, 0x04, 0x0a, 0xe4, 0x7a, 0xd5, 0x2d, 0x6c, 0xde, 0x3e, 0x1a, 0x47, 0x17, 0x88, 0x63, 0x20, 0x9d, 0x21, 0x3e, 0x0c, 0x6f, 0xfd, 0x20, 0x54, 0xd0, 0x67, 0xd2, 0x6b, 0x06, 0xfe, 0x60, 0x13, 0x42, 0x3d, 0xb7, 0xca, 0xcb, 0xab, 0x7b, 0x5f, 0x5d, 0x01, 0x56, 0xd3, 0x99, 0x80, 0x0f, 0xde, 0x7f, 0x3a, 0x61, 0x9c, 0xd3, 0x6b, 0x5e, 0xfe, 0xb5, 0xfc, 0x39, 0x8b, 0x8e, 0xf0, 0x8c, 0x8b, 0x65, 0x46, 0x45, 0xff, 0x47, 0x8f, 0xd4, 0xdd, 0xae, 0xc9, 0x72, 0xc7, 0x7f, 0x28, 0x86, 0xf1, 0xf7, 0x6e, 0xcb, 0x86, 0x03, 0xeb, 0x0c, 0x46, 0xe5, 0xa0, 0x6b, 0xef, 0xd4, 0x5e, 0xa4, 0x0f, 0x53, 0xe1, 0xbc, 0xb4, 0xc9, 0x37, 0x0e, 0x75, 0xdd, 0x93, 0xe8, 0x0f, 0x18, 0x0a, 0x02, 0x83, 0x17, 0x74, 0xbb, 0x1a, 0x42, 0x5b, 0x63, 0x2c, 0x80, 0x80, 0xa6, 0x84 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const RSA_INT: [u8; 724] = [ 0x30, 0x82, 0x02, 0xd0, 0x30, 0x82, 0x01, 0xba, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x07, 0x10, 0xaf, 0xc4, 0x1a, 0x3a, 0x56, 0x4f, 0xd8, 0xc2, 0xcc, 0x46, 0xd7, 0x5b, 0xdf, 0x1c, 0x4e, 0x2f, 0x49, 0x3a, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x72, 0x73, 0x61, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x69, 0x6e, 0x74, 0x2d, 0x72, 0x73, 0x61, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xba, 0x88, 0x51, 0xa8, 0x44, 0x8e, 0x16, 0xd6, 0x41, 0xfd, 0x6e, 0xb6, 0x88, 0x06, 0x36, 0x10, 0x3d, 0x3c, 0x13, 0xd9, 0xea, 0xe4, 0x35, 0x4a, 0xb4, 0xec, 0xf5, 0x68, 0x57, 0x6c, 0x24, 0x7b, 0xc1, 0xc7, 0x25, 0xa8, 0xe0, 0xd8, 0x1f, 0xbd, 0xb1, 0x9c, 0x06, 0x9b, 0x6e, 0x1a, 0x86, 0xf2, 0x6b, 0xe2, 0xaf, 0x5a, 0x75, 0x6b, 0x6a, 0x64, 0x71, 0x08, 0x7a, 0xa5, 0x5a, 0xa7, 0x45, 0x87, 0xf7, 0x1c, 0xd5, 0x24, 0x9c, 0x02, 0x7e, 0xcd, 0x43, 0xfc, 0x1e, 0x69, 0xd0, 0x38, 0x20, 0x29, 0x93, 0xab, 0x20, 0xc3, 0x49, 0xe4, 0xdb, 0xb9, 0x4c, 0xc2, 0x6b, 0x6c, 0x0e, 0xed, 0x15, 0x82, 0x0f, 0xf1, 0x7e, 0xad, 0x69, 0x1a, 0xb1, 0xd3, 0x02, 0x3a, 0x8b, 0x2a, 0x41, 0xee, 0xa7, 0x70, 0xe0, 0x0f, 0x0d, 0x8d, 0xfd, 0x66, 0x0b, 0x2b, 0xb0, 0x24, 0x92, 0xa4, 0x7d, 0xb9, 0x88, 0x61, 0x79, 0x90, 0xb1, 0x57, 0x90, 0x3d, 0xd2, 0x3b, 0xc5, 0xe0, 0xb8, 0x48, 0x1f, 0xa8, 0x37, 0xd3, 0x88, 0x43, 0xef, 0x27, 0x16, 0xd8, 0x55, 0xb7, 0x66, 0x5a, 0xaa, 0x7e, 0x02, 0x90, 0x2f, 0x3a, 0x7b, 0x10, 0x80, 0x06, 0x24, 0xcc, 0x1c, 0x6c, 0x97, 0xad, 0x96, 0x61, 0x5b, 0xb7, 0xe2, 0x96, 0x12, 0xc0, 0x75, 0x31, 0xa3, 0x0c, 0x91, 0xdd, 0xb4, 0xca, 0xf7, 0xfc, 0xad, 0x1d, 0x25, 0xd3, 0x09, 0xef, 0xb9, 0x17, 0x0e, 0xa7, 0x68, 0xe1, 0xb3, 0x7b, 0x2f, 0x22, 0x6f, 0x69, 0xe3, 0xb4, 0x8a, 0x95, 0x61, 0x1d, 0xee, 0x26, 0xd6, 0x25, 0x9d, 0xab, 0x91, 0x08, 0x4e, 0x36, 0xcb, 0x1c, 0x24, 0x04, 0x2c, 0xbf, 0x16, 0x8b, 0x2f, 0xe5, 0xf1, 0x8f, 0x99, 0x17, 0x31, 0xb8, 0xb3, 0xfe, 0x49, 0x23, 0xfa, 0x72, 0x51, 0xc4, 0x31, 0xd5, 0x03, 0xac, 0xda, 0x18, 0x0a, 0x35, 0xed, 0x8d, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x1d, 0x30, 0x1b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x03, 0x82, 0x01, 0x01, 0x00, 0x5e, 0xba, 0x69, 0x55, 0x9f, 0xf8, 0xeb, 0x16, 0x21, 0x98, 0xde, 0xb7, 0x31, 0x3e, 0x66, 0xe1, 0x3b, 0x0c, 0x29, 0xf7, 0x48, 0x73, 0x05, 0xd9, 0xce, 0x5e, 0x4c, 0xbe, 0x03, 0xc4, 0x51, 0xd6, 0x21, 0x92, 0x40, 0x38, 0xaa, 0x5b, 0x28, 0xb5, 0xa1, 0x10, 0x52, 0x57, 0xff, 0x91, 0x54, 0x82, 0x86, 0x9e, 0x74, 0xd5, 0x3d, 0x82, 0x29, 0xee, 0xd1, 0xcf, 0x93, 0xb1, 0x24, 0x76, 0xbb, 0x95, 0x41, 0x06, 0x7e, 0x40, 0x9b, 0xb4, 0xab, 0x44, 0x34, 0x10, 0x8f, 0xb1, 0x51, 0x6f, 0xc0, 0x89, 0xd1, 0xa3, 0xc4, 0x9f, 0xb3, 0x48, 0xe1, 0xcd, 0x73, 0xad, 0xff, 0x42, 0x5f, 0x76, 0x05, 0x60, 0xc5, 0xe0, 0x45, 0x79, 0x18, 0xa1, 0x19, 0xb8, 0xa7, 0x3a, 0x64, 0xb3, 0x19, 0xba, 0x14, 0xa1, 0xb5, 0xdc, 0x32, 0xec, 0x09, 0x39, 0x58, 0x54, 0x5b, 0x04, 0xdc, 0x1b, 0x66, 0x0d, 0x1d, 0x0d, 0xce, 0x7f, 0xfa, 0x24, 0x52, 0x6a, 0xad, 0xe2, 0xc8, 0x30, 0xaf, 0xf2, 0xaf, 0x63, 0xc5, 0xe2, 0xbf, 0xe2, 0x20, 0x1b, 0x9e, 0xf9, 0x3d, 0xbc, 0xfb, 0x04, 0x8e, 0xda, 0x7a, 0x1a, 0x5d, 0xd3, 0x13, 0xd7, 0x00, 0x8e, 0x9b, 0x5d, 0x85, 0x51, 0xda, 0xd3, 0x91, 0x25, 0xf5, 0x67, 0x85, 0x3e, 0x25, 0x89, 0x5e, 0xcb, 0x89, 0x8a, 0xec, 0x8a, 0xde, 0x8b, 0xf4, 0x33, 0x5f, 0x76, 0xdb, 0x3d, 0xfc, 0x6a, 0x05, 0x21, 0x43, 0xb2, 0x41, 0xd8, 0x33, 0x8d, 0xfd, 0x05, 0x5c, 0x22, 0x0a, 0xf6, 0x90, 0x65, 0x9c, 0x4f, 0x8c, 0x44, 0x9f, 0x2d, 0xca, 0xf3, 0x49, 0x9c, 0x3a, 0x14, 0x88, 0xab, 0xe4, 0xce, 0xb7, 0xbc, 0x95, 0x22, 0x2e, 0xb1, 0x82, 0x4c, 0xbf, 0x83, 0x3e, 0x49, 0x72, 0x03, 0x2a, 0x68, 0xe7, 0x2d, 0xe5, 0x2d, 0x4b, 0x61, 0xb0, 0x8d, 0x0d, 0x0c, 0x87, 0xc6, 0x5c, 0x51 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const RSA_ROOT: [u8; 725] = [ 0x30, 0x82, 0x02, 0xd1, 0x30, 0x82, 0x01, 0xbb, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x29, 0x6c, 0x1a, 0xd8, 0x20, 0xcd, 0x74, 0x6d, 0x4b, 0x00, 0xf3, 0x16, 0x88, 0xd9, 0x66, 0x87, 0x5f, 0x28, 0x56, 0x6a, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x72, 0x73, 0x61, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x31, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x72, 0x73, 0x61, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xba, 0x88, 0x51, 0xa8, 0x44, 0x8e, 0x16, 0xd6, 0x41, 0xfd, 0x6e, 0xb6, 0x88, 0x06, 0x36, 0x10, 0x3d, 0x3c, 0x13, 0xd9, 0xea, 0xe4, 0x35, 0x4a, 0xb4, 0xec, 0xf5, 0x68, 0x57, 0x6c, 0x24, 0x7b, 0xc1, 0xc7, 0x25, 0xa8, 0xe0, 0xd8, 0x1f, 0xbd, 0xb1, 0x9c, 0x06, 0x9b, 0x6e, 0x1a, 0x86, 0xf2, 0x6b, 0xe2, 0xaf, 0x5a, 0x75, 0x6b, 0x6a, 0x64, 0x71, 0x08, 0x7a, 0xa5, 0x5a, 0xa7, 0x45, 0x87, 0xf7, 0x1c, 0xd5, 0x24, 0x9c, 0x02, 0x7e, 0xcd, 0x43, 0xfc, 0x1e, 0x69, 0xd0, 0x38, 0x20, 0x29, 0x93, 0xab, 0x20, 0xc3, 0x49, 0xe4, 0xdb, 0xb9, 0x4c, 0xc2, 0x6b, 0x6c, 0x0e, 0xed, 0x15, 0x82, 0x0f, 0xf1, 0x7e, 0xad, 0x69, 0x1a, 0xb1, 0xd3, 0x02, 0x3a, 0x8b, 0x2a, 0x41, 0xee, 0xa7, 0x70, 0xe0, 0x0f, 0x0d, 0x8d, 0xfd, 0x66, 0x0b, 0x2b, 0xb0, 0x24, 0x92, 0xa4, 0x7d, 0xb9, 0x88, 0x61, 0x79, 0x90, 0xb1, 0x57, 0x90, 0x3d, 0xd2, 0x3b, 0xc5, 0xe0, 0xb8, 0x48, 0x1f, 0xa8, 0x37, 0xd3, 0x88, 0x43, 0xef, 0x27, 0x16, 0xd8, 0x55, 0xb7, 0x66, 0x5a, 0xaa, 0x7e, 0x02, 0x90, 0x2f, 0x3a, 0x7b, 0x10, 0x80, 0x06, 0x24, 0xcc, 0x1c, 0x6c, 0x97, 0xad, 0x96, 0x61, 0x5b, 0xb7, 0xe2, 0x96, 0x12, 0xc0, 0x75, 0x31, 0xa3, 0x0c, 0x91, 0xdd, 0xb4, 0xca, 0xf7, 0xfc, 0xad, 0x1d, 0x25, 0xd3, 0x09, 0xef, 0xb9, 0x17, 0x0e, 0xa7, 0x68, 0xe1, 0xb3, 0x7b, 0x2f, 0x22, 0x6f, 0x69, 0xe3, 0xb4, 0x8a, 0x95, 0x61, 0x1d, 0xee, 0x26, 0xd6, 0x25, 0x9d, 0xab, 0x91, 0x08, 0x4e, 0x36, 0xcb, 0x1c, 0x24, 0x04, 0x2c, 0xbf, 0x16, 0x8b, 0x2f, 0xe5, 0xf1, 0x8f, 0x99, 0x17, 0x31, 0xb8, 0xb3, 0xfe, 0x49, 0x23, 0xfa, 0x72, 0x51, 0xc4, 0x31, 0xd5, 0x03, 0xac, 0xda, 0x18, 0x0a, 0x35, 0xed, 0x8d, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x1d, 0x30, 0x1b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x03, 0x82, 0x01, 0x01, 0x00, 0x23, 0x2f, 0x9f, 0x72, 0xeb, 0x70, 0x6d, 0x9e, 0x3e, 0x9f, 0xd7, 0x9c, 0xd9, 0x19, 0x7c, 0x99, 0x07, 0xc5, 0x5c, 0x9d, 0xf5, 0x66, 0x9f, 0x28, 0x8d, 0xfe, 0x0e, 0x3f, 0x38, 0x75, 0xed, 0xee, 0x4e, 0x3f, 0xf6, 0x6e, 0x35, 0xe0, 0x95, 0x3f, 0x08, 0x4a, 0x71, 0x5a, 0xf2, 0x4f, 0xc9, 0x96, 0x61, 0x8d, 0x45, 0x4b, 0x97, 0x85, 0xff, 0xb0, 0xe3, 0xbb, 0xb5, 0xd7, 0x7e, 0xfb, 0xd2, 0xfc, 0xec, 0xfe, 0x42, 0x9f, 0x4e, 0x7b, 0xbf, 0x97, 0xbb, 0xb4, 0x3a, 0x93, 0x0b, 0x13, 0x61, 0x90, 0x0c, 0x3a, 0xce, 0xf7, 0x8e, 0xef, 0x80, 0xf5, 0x4a, 0x92, 0xc5, 0xa5, 0x03, 0x78, 0xc2, 0xee, 0xb8, 0x66, 0x60, 0x6b, 0x76, 0x4f, 0x32, 0x5a, 0x1a, 0xa2, 0x4b, 0x7e, 0x2b, 0xa6, 0x1a, 0x89, 0x01, 0xe3, 0xbb, 0x55, 0x13, 0x7c, 0x4c, 0xf4, 0x6a, 0x99, 0x94, 0xd1, 0xa0, 0x84, 0x1c, 0x1a, 0xc2, 0x7b, 0xb4, 0xa0, 0xb0, 0x3b, 0xdc, 0x5a, 0x7b, 0xc7, 0xe0, 0x44, 0xb2, 0x1f, 0x46, 0xd5, 0x8b, 0x39, 0x8b, 0xdc, 0x9e, 0xce, 0xa8, 0x7f, 0x85, 0x1d, 0x4b, 0x63, 0x06, 0x1e, 0x8e, 0xe5, 0xe5, 0x99, 0xd9, 0xf7, 0x4d, 0x89, 0x0b, 0x1d, 0x5c, 0x27, 0x33, 0x66, 0x21, 0xcf, 0x9a, 0xbd, 0x98, 0x68, 0x23, 0x3a, 0x66, 0x9d, 0xd4, 0x46, 0xed, 0x63, 0x58, 0xf3, 0x42, 0xe4, 0x1d, 0xe2, 0x47, 0x65, 0x13, 0x8d, 0xd4, 0x1f, 0x4b, 0x7e, 0xde, 0x11, 0x56, 0xf8, 0x6d, 0x01, 0x0c, 0x99, 0xbd, 0x8d, 0xca, 0x8a, 0x2e, 0xe3, 0x8a, 0x9c, 0x3d, 0x83, 0x8d, 0x69, 0x62, 0x8d, 0x05, 0xea, 0xb7, 0xf5, 0xa3, 0x4b, 0xfc, 0x96, 0xcf, 0x18, 0x21, 0x0a, 0xc7, 0xf3, 0x23, 0x7e, 0x1c, 0xab, 0xe2, 0xa2, 0xd1, 0x83, 0xc4, 0x25, 0x93, 0x37, 0x80, 0xca, 0xda, 0xf0, 0xef, 0x7d, 0x94, 0xb5 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const XPI_SIGNATURE: [u8; 646] = [ 0xd8, 0x62, 0x84, 0x43, 0xa1, 0x04, 0x80, 0xa0, 0xf6, 0x81, 0x83, 0x59, 0x02, 0x35, 0xa2, 0x01, 0x26, 0x04, 0x59, 0x02, 0x2e, 0x30, 0x82, 0x02, 0x2a, 0x30, 0x82, 0x01, 0x12, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x17, 0x03, 0x6b, 0xc1, 0xfe, 0xb4, 0x38, 0xe1, 0x83, 0x8f, 0xe5, 0xa7, 0xca, 0xf1, 0x54, 0x32, 0x4c, 0x8b, 0xf3, 0x05, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x29, 0x31, 0x27, 0x30, 0x25, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1e, 0x78, 0x70, 0x63, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x61, 0x70, 0x70, 0x73, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x35, 0x31, 0x31, 0x32, 0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x38, 0x30, 0x32, 0x30, 0x35, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x2b, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x20, 0x20, 0x78, 0x70, 0x63, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x61, 0x70, 0x70, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4f, 0xbf, 0xbb, 0xbb, 0x61, 0xe0, 0xf8, 0xf9, 0xb1, 0xa6, 0x0a, 0x59, 0xac, 0x87, 0x04, 0xe2, 0xec, 0x05, 0x0b, 0x42, 0x3e, 0x3c, 0xf7, 0x2e, 0x92, 0x3f, 0x2c, 0x4f, 0x79, 0x4b, 0x45, 0x5c, 0x2a, 0x69, 0xd2, 0x33, 0x45, 0x6c, 0x36, 0xc4, 0x11, 0x9d, 0x07, 0x06, 0xe0, 0x0e, 0xed, 0xc8, 0xd1, 0x93, 0x90, 0xd7, 0x99, 0x1b, 0x7b, 0x2d, 0x07, 0xa3, 0x04, 0xea, 0xa0, 0x4a, 0xa6, 0xc0, 0xa3, 0x0f, 0x30, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x4f, 0x5c, 0xcb, 0x1d, 0xea, 0x71, 0x58, 0xfe, 0xe2, 0x49, 0x11, 0x16, 0x65, 0xbc, 0x23, 0x6d, 0xda, 0x46, 0x7e, 0x98, 0x93, 0x5d, 0x48, 0x2a, 0xa0, 0xbb, 0x7f, 0x4e, 0xbd, 0x01, 0x0a, 0x1a, 0x30, 0xff, 0xce, 0x03, 0xf5, 0x9c, 0xd9, 0x84, 0x69, 0x7a, 0x5a, 0xe3, 0x43, 0xd2, 0xd4, 0xbc, 0xab, 0x4d, 0x17, 0x8f, 0x10, 0x6a, 0xcf, 0xde, 0x17, 0x1d, 0x7d, 0x16, 0x03, 0x7e, 0x21, 0xf0, 0x32, 0x02, 0x89, 0x67, 0x32, 0x5a, 0xfe, 0xd5, 0xd9, 0x31, 0x53, 0xdc, 0xd7, 0xba, 0x2a, 0x9f, 0xd3, 0x59, 0x8d, 0x61, 0xb9, 0x6e, 0xf7, 0x6e, 0x86, 0x61, 0xdd, 0xfd, 0xe1, 0x73, 0xfe, 0xef, 0x9d, 0xe9, 0x99, 0x9e, 0x51, 0xe8, 0x5d, 0xf7, 0x48, 0x77, 0x8e, 0xc6, 0xe8, 0x53, 0x05, 0x7b, 0x5c, 0x2c, 0x28, 0xe7, 0x0a, 0x07, 0xbf, 0xea, 0xc1, 0x06, 0x11, 0x0d, 0xe7, 0x60, 0xd0, 0x79, 0x94, 0xe9, 0x26, 0xf1, 0x93, 0x71, 0x7b, 0x5b, 0x02, 0x3b, 0x5d, 0x51, 0xb8, 0x19, 0x38, 0x16, 0xab, 0x48, 0x30, 0xf3, 0xec, 0xd9, 0xd5, 0x8f, 0xc7, 0x9a, 0x02, 0xfd, 0x12, 0x57, 0x82, 0x0e, 0xde, 0xce, 0xfc, 0x50, 0x42, 0x2a, 0x41, 0xc7, 0xc6, 0xa8, 0x80, 0x37, 0x7c, 0xc4, 0x47, 0xad, 0xf5, 0xd8, 0xcb, 0xe8, 0xae, 0x0c, 0x01, 0x80, 0x60, 0x35, 0x93, 0x0a, 0x21, 0x81, 0x33, 0xd1, 0xd6, 0x6a, 0x1b, 0xe7, 0xb6, 0xd9, 0x91, 0x50, 0xc2, 0xbd, 0x16, 0xda, 0xb7, 0x68, 0x60, 0xf2, 0x20, 0xaa, 0x72, 0x8c, 0x76, 0x0a, 0x54, 0x7a, 0x05, 0xd8, 0xa1, 0xcd, 0xe9, 0x07, 0x8a, 0x02, 0x07, 0x4b, 0x87, 0x7d, 0xb5, 0x27, 0xca, 0x38, 0xb3, 0x30, 0xaf, 0x97, 0xe0, 0xb7, 0x35, 0x14, 0x08, 0xab, 0x01, 0xb0, 0x14, 0x08, 0x5c, 0x4b, 0xfb, 0x76, 0x0a, 0x95, 0xfc, 0xb4, 0xb8, 0x34, 0xa0, 0x58, 0x40, 0x5c, 0x75, 0x51, 0x9f, 0x13, 0x11, 0x50, 0xcd, 0x5d, 0x8a, 0xde, 0x20, 0xa3, 0xbc, 0x06, 0x30, 0x91, 0xff, 0xb2, 0x73, 0x75, 0x5f, 0x31, 0x64, 0xec, 0xfd, 0xcb, 0x42, 0x80, 0x0a, 0x70, 0xe6, 0x82, 0x02, 0x0a, 0xe8, 0x69, 0x13, 0xd5, 0xf4, 0x1b, 0xab, 0xb6, 0xbb, 0x59, 0x93, 0x08, 0x48, 0x68, 0x9c, 0xbd, 0x72, 0xc7, 0xcb, 0x37, 0xde, 0x26, 0xbc, 0xe9, 0x83, 0x0e, 0xd8, 0x90, 0xa3 ]; #[cfg_attr(rustfmt, rustfmt_skip)] pub const XPI_PAYLOAD: [u8; 236] = [ 0x4E, 0x61, 0x6D, 0x65, 0x3A, 0x20, 0x6D, 0x61, 0x6E, 0x69, 0x66, 0x65, 0x73, 0x74, 0x2E, 0x6A, 0x73, 0x6F, 0x6E, 0x0A, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x2D, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x3A, 0x20, 0x42, 0x54, 0x6E, 0x43, 0x70, 0x54, 0x31, 0x35, 0x34, 0x4E, 0x32, 0x36, 0x52, 0x5A, 0x6D, 0x38, 0x62, 0x68, 0x64, 0x44, 0x34, 0x33, 0x57, 0x58, 0x64, 0x30, 0x74, 0x6A, 0x35, 0x62, 0x67, 0x36, 0x6F, 0x66, 0x4D, 0x31, 0x39, 0x4E, 0x4C, 0x49, 0x30, 0x4F, 0x45, 0x3D, 0x0A, 0x0A, 0x4E, 0x61, 0x6D, 0x65, 0x3A, 0x20, 0x52, 0x45, 0x41, 0x44, 0x4D, 0x45, 0x0A, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x2D, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x3A, 0x20, 0x62, 0x59, 0x30, 0x6C, 0x39, 0x78, 0x71, 0x47, 0x4A, 0x59, 0x43, 0x70, 0x71, 0x59, 0x65, 0x4A, 0x30, 0x4B, 0x36, 0x71, 0x34, 0x44, 0x57, 0x55, 0x51, 0x71, 0x75, 0x30, 0x6D, 0x4E, 0x42, 0x46, 0x4D, 0x34, 0x48, 0x34, 0x65, 0x6D, 0x68, 0x6A, 0x69, 0x4A, 0x67, 0x3D, 0x0A, 0x0A, 0x4E, 0x61, 0x6D, 0x65, 0x3A, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2F, 0x69, 0x6D, 0x61, 0x67, 0x65, 0x2E, 0x70, 0x6E, 0x67, 0x0A, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x2D, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x3A, 0x20, 0x45, 0x50, 0x6A, 0x6B, 0x4E, 0x5A, 0x77, 0x79, 0x61, 0x39, 0x58, 0x2B, 0x70, 0x72, 0x75, 0x4C, 0x6C, 0x78, 0x47, 0x2B, 0x46, 0x41, 0x43, 0x4C, 0x77, 0x47, 0x43, 0x34, 0x38, 0x58, 0x55, 0x34, 0x53, 0x39, 0x6F, 0x5A, 0x4F, 0x41, 0x30, 0x6C, 0x56, 0x56, 0x51, 0x3D, 0x0A ];<|fim▁end|>
0x04, 0x18, 0x94, 0x55, 0x0d, 0x07, 0x85, 0x93, 0x2e, 0x00, 0xea, 0xa2,
<|file_name|>rasterizer.rs<|end_file_name|><|fim▁begin|>use na::{Vector3, Vector4, Point3, Point4, Matrix3, Matrix4, Isometry3}; use na::{Norm, Diagonal, Inverse, Transpose}; use na; use std::path; use std::fs::File; use std::error::Error; use std::io::prelude::*; use std::f32; use std::i64; use std::f32::consts; use stb_image::image; use time::{PreciseTime}; use std::cmp; use ansi_term; use scoped_threadpool; use std::cell::UnsafeCell; use num_cpus; // // ------------------------------------------ // General Utilities & Linear Algebra Helpers // ------------------------------------------ // type V3F = Vector3<f32>; type P3F = Point3<f32>; fn deg_to_rad(deg: f32) -> f32 { // std::f32::to_radians() is still unstable deg * 0.0174532925 } fn max3<T: PartialOrd>(a: T, b: T, c: T) -> T { if a > b { if a > c { a } else { c } } else { if b > c { b } else { c } } } fn min3<T: PartialOrd>(a: T, b: T, c: T) -> T { if a < b { if a < c { a } else { c } } else { if b < c { b } else { c } } } fn face_normal(v0: &P3F, v1: &P3F, v2: &P3F) -> V3F { na::normalize(&na::cross(&(*v1 - *v0), &(*v2 - *v0))) } fn fast_normalize(n: &V3F) -> V3F { // nalgbera doesn't use a reciprocal let l = 1.0 / (n.x * n.x + n.y * n.y + n.z * n.z).sqrt(); Vector3::new(n.x * l, n.y * l, n.z * l) } fn reflect(i: &V3F, n: &V3F) -> V3F { // GLSL style reflection vector function *i - (*n * na::dot(n, i) * 2.0) } // // ------------------------- // Mesh Loading & Processing // ------------------------- // struct Vertex { p: P3F, n: V3F, col: V3F } impl Vertex { fn new(px: f32, py: f32, pz: f32, nx: f32, ny: f32, nz: f32, r: f32, g: f32, b: f32) -> Vertex { Vertex { p: Point3 ::new(px, py, pz), n: Vector3::new(nx, ny, nz), col: Vector3::new(r , g , b) } } } // Indexed triangle representation struct Triangle { v0: u32, v1: u32, v2: u32 } impl Triangle { fn new(v0: u32, v1: u32, v2: u32) -> Triangle { Triangle { v0: v0, v1: v1, v2: v2 } } } struct Mesh { tri: Vec<Triangle>, vtx: Vec<Vertex>, aabb_min: V3F, aabb_max: V3F } impl Mesh { fn new(tri: Vec<Triangle>, vtx: Vec<Vertex>) -> Mesh { // Compute AABB let mut mesh = Mesh { tri: tri, vtx: vtx, aabb_min: na::zero(), aabb_max: na::zero() }; mesh.update_aabb(); mesh } fn update_aabb(&mut self) { self.aabb_min = Vector3::new(f32::MAX, f32::MAX, f32::MAX); self.aabb_max = Vector3::new(f32::MIN, f32::MIN, f32::MIN); for v in &self.vtx { self.aabb_min.x = if self.aabb_min.x < v.p.x { self.aabb_min.x } else { v.p.x }; self.aabb_min.y = if self.aabb_min.y < v.p.y { self.aabb_min.y } else { v.p.y }; self.aabb_min.z = if self.aabb_min.z < v.p.z { self.aabb_min.z } else { v.p.z }; self.aabb_max.x = if self.aabb_max.x > v.p.x { self.aabb_max.x } else { v.p.x }; self.aabb_max.y = if self.aabb_max.y > v.p.y { self.aabb_max.y } else { v.p.y }; self.aabb_max.z = if self.aabb_max.z > v.p.z { self.aabb_max.z } else { v.p.z }; } } fn normalize_dimensions(&self) -> Matrix4<f32> { // Build a matrix to transform the mesh to a unit cube with the origin as its center // Translate to center let center = (self.aabb_min + self.aabb_max) / 2.0; let transf = Isometry3::new(-center, na::zero()); // Scale to unit cube let extends = self.aabb_max - self.aabb_min; let extends_max = max3(extends.x, extends.y, extends.z); let extends_scale = 1.0 / extends_max; let scale: Matrix4<f32> = Diagonal::from_diagonal(&Vector4::new(extends_scale, extends_scale, extends_scale, 1.0)); scale * na::to_homogeneous(&transf) } } // We have a few different combinations of vertex attributes in the mesh file format #[derive(PartialEq, Debug)] enum MeshFileType { XyzNxNyNz, XyzNxNyNzRGB, XyzRGB } fn load_mesh(file_name: &str, mesh_file_type: MeshFileType) -> Mesh { // Load a text format mesh from disk let file_name = &file_name.to_string(); let path = path::Path::new(file_name); let display = path.display(); // Open mesh file let mut file = match File::open(&path) { Err(why) => panic!("load_mesh(): Couldn't open {}: {}", display, Error::description(&why)), Ok(file) => file }; // Read entire mesh file into memory let mut data_str = String::new(); match file.read_to_string(&mut data_str) { Err(why) => panic!("load_mesh(): Couldn't read {}: {}", display, Error::description(&why)), Ok(_) => () }; // Parse mesh format line-by-line let mut lines = data_str.lines(); // Comment header / vertex count let vtx_cnt; loop { match lines.next() { Some("") => (), // Skip empty lines Some(ln) => { let words: Vec<&str> = ln.split(" ").collect(); if words[0] == "#" { continue } // Skip comments // First non-empty, non-comment line should contain the vertex count vtx_cnt = match words[0].parse::<u32>() { Err(why) => panic!("load_mesh(): Can't parse vertex count: {}: {}", Error::description(&why), display), Ok(n) => n }; break; } None => panic!("load_mesh(): EOF while parsing vertex count: {}", display) } } // Vertices let mut vtx: Vec<Vertex> = Vec::new(); loop { match lines.next() { Some("") => (), // Skip empty lines Some(ln) => { let mut words = ln.split(" "); let words_collect: Vec<&str> = words.clone().collect(); let num_components = match mesh_file_type { MeshFileType::XyzNxNyNzRGB => 9, MeshFileType::XyzNxNyNz | MeshFileType::XyzRGB => 6 }; if words_collect.len() != num_components { panic!("load_mesh(): Expected {} component vertices: {}", num_components, display); } let mut components: Vec<f32> = Vec::new(); for _ in 0..num_components { components.push(words.next().unwrap().parse::<f32>().unwrap()); } match mesh_file_type { MeshFileType::XyzRGB => vtx.push(Vertex::new(components[0], components[1], components[2], // Compute the normal later 0.0, 0.0, 0.0, components[3], components[4], components[5] )), MeshFileType::XyzNxNyNzRGB => vtx.push(Vertex::new(components[0], components[1], components[2], components[3], components[4], components[5], components[6], components[7], components[8] )), MeshFileType::XyzNxNyNz => vtx.push(Vertex::new(components[0], components[1], components[2], components[3], components[4], components[5], // White as default color 1.0, 1.0, 1.0 )) } // Done? if vtx.len() == vtx_cnt as usize { break } } None => panic!("load_mesh(): EOF while parsing vertices: {}", display) } } if vtx_cnt < 3 { panic!("load_mesh(): Bogus vertex count: {}: {}", vtx_cnt, display) } // Index count let idx_cnt; loop { match lines.next() { Some("") => (), // Skip empty lines Some(ln) => { // First non-empty, non-comment line should contain the index count idx_cnt = match ln.parse::<u32>() { Err(why) => panic!("load_mesh(): Can't parse index count: {}: {}", Error::description(&why), display), Ok(n) => n }; break; } None => panic!("load_mesh(): EOF while parsing index count: {}", display) } } if idx_cnt % 3 != 0 { panic!("load_mesh(): Bogus index count: {}: {}", idx_cnt, display) } // Indices let mut idx: Vec<(u32, u32, u32)> = Vec::new(); loop { match lines.next() { Some("") => (), // Skip empty lines Some(ln) => { let mut words = ln.split(" "); let words_collect: Vec<&str> = words.clone().collect(); if words_collect.len() != 3 { panic!("load_mesh(): Expected 3 component indexed triangles: {}", display); } let mut components: Vec<u32> = Vec::new(); for _ in 0..3 { let idx = words.next().unwrap().parse::<u32>().unwrap(); if idx >= vtx_cnt { panic!("load_mesh(): Out-of-bounds index: {}: {}", idx, display) } components.push(idx); } idx.push((components[0], components[1], components[2])); // Done? if idx.len() * 3 == idx_cnt as usize { break } } None => panic!("load_mesh(): EOF while parsing indices: {}", display) } } // Assemble triangle vector and mesh let mut tri = Vec::new(); for tri_idx in idx { let ntri = Triangle::new(tri_idx.0, tri_idx.1, tri_idx.2); if mesh_file_type == MeshFileType::XyzRGB { // Set vertex normals from face normal // TODO: This obviously does not take sharing into account at all, but it's // OK for now as we're only using it with very simple meshes let v0p = Point3::new(vtx[tri_idx.0 as usize].p.x, vtx[tri_idx.0 as usize].p.y, vtx[tri_idx.0 as usize].p.z); let v1p = Point3::new(vtx[tri_idx.1 as usize].p.x, vtx[tri_idx.1 as usize].p.y, vtx[tri_idx.1 as usize].p.z); let v2p = Point3::new(vtx[tri_idx.2 as usize].p.x, vtx[tri_idx.2 as usize].p.y, vtx[tri_idx.2 as usize].p.z); let n = face_normal(&v0p, &v1p, &v2p); vtx[tri_idx.0 as usize].n = n; vtx[tri_idx.1 as usize].n = n; vtx[tri_idx.2 as usize].n = n; } tri.push(ntri); } let mesh = Mesh::new(tri, vtx); // Print some mesh information println!("load_mesh(): Loaded {} Tri and {} Vtx (format: {:?}) from '{}', \ AABB ({}, {}, {}) - ({}, {}, {})", mesh.tri.len(), mesh.vtx.len(), mesh_file_type, display, mesh.aabb_min.x, mesh.aabb_min.y, mesh.aabb_min.z, mesh.aabb_max.x, mesh.aabb_max.y, mesh.aabb_max.z); mesh } #[no_mangle] pub extern fn rast_get_num_meshes() -> i32 { 12 } #[no_mangle] pub extern fn rast_get_mesh_name(idx: i32) -> *const u8 { mesh_by_idx(idx).0.as_ptr() } #[no_mangle] pub extern fn rast_get_mesh_tri_cnt(idx: i32) -> i32 { mesh_by_idx(idx).2.tri.len() as i32 } fn mesh_by_idx<'a>(idx: i32) -> (&'a str, CameraFromTime, &'a Mesh) { // Retrieve mesh name, camera and geometry by its index. We do this in such an awkward // way so we can take advantage of the on-demand loading of the meshes through // lazy_static // Mesh geometry lazy_static! { static ref MESH_KILLEROO: Mesh = load_mesh("meshes/killeroo_ao.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_HEAD: Mesh = load_mesh("meshes/head_ao.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_MITSUBA: Mesh = load_mesh("meshes/mitsuba_ao.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_CAT: Mesh = load_mesh("meshes/cat_ao.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_HAND: Mesh = load_mesh("meshes/hand_ao.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_TEAPOT: Mesh = load_mesh("meshes/teapot.dat" , MeshFileType::XyzNxNyNz ); static ref MESH_TORUS_KNOT: Mesh = load_mesh("meshes/torus_knot.dat" , MeshFileType::XyzNxNyNz ); static ref MESH_DWARF: Mesh = load_mesh("meshes/dwarf.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_BLOB: Mesh = load_mesh("meshes/blob.dat" , MeshFileType::XyzNxNyNz ); static ref MESH_CUBE: Mesh = load_mesh("meshes/cube.dat" , MeshFileType::XyzNxNyNzRGB); static ref MESH_SPHERE: Mesh = load_mesh("meshes/sphere.dat" , MeshFileType::XyzNxNyNz ); static ref MESH_CORNELL: Mesh = load_mesh("meshes/cornell_radiosity.dat", MeshFileType::XyzRGB ); } // Name, camera and geometry tuple match idx { // Null terminated names so we can easily pass them as C strings 0 => ("Killeroo\0" , cam_orbit_front, &MESH_KILLEROO ), 1 => ("Head\0" , cam_orbit_closer, &MESH_HEAD ), 2 => ("Mitsuba\0" , cam_pan_front, &MESH_MITSUBA ), 3 => ("Cat\0" , cam_orbit_closer, &MESH_CAT ), 4 => ("Hand\0" , cam_orbit_closer, &MESH_HAND ), 5 => ("Teapot\0" , cam_orbit_closer, &MESH_TEAPOT ), 6 => ("TorusKnot\0" , cam_orbit, &MESH_TORUS_KNOT), 7 => ("Dwarf\0" , cam_orbit_front, &MESH_DWARF ), 8 => ("Blob\0" , cam_orbit, &MESH_BLOB ), 9 => ("Cube\0" , cam_orbit, &MESH_CUBE ), 10 => ("Sphere\0" , cam_orbit, &MESH_SPHERE ), 11 => ("CornellBox\0", cam_pan_back , &MESH_CORNELL ), _ => panic!("mesh_by_idx: Invalid index: {}", idx) } } // // ----------------- // Camera Animations // ----------------- // // Eye position at the given time type CameraFromTime = fn(f64) -> P3F; fn cam_orbit(tick: f64) -> P3F { // Orbit around object Point3::new(((tick / 1.25).cos() * 1.8) as f32, 0.0, ((tick / 1.25).sin() * 1.8) as f32) } fn cam_orbit_closer(tick: f64) -> P3F { // Orbit closer around object Point3::new(((tick / 1.25).cos() * 1.6) as f32, 0.0, ((tick / 1.25).sin() * 1.6) as f32) } fn cam_orbit_front(tick: f64) -> P3F { // Slow, dampened orbit around the front of the object, some slow vertical bobbing as well let tick_slow = tick / 3.5; let reverse = tick_slow as i64 % 2 == 1; let tick_f = if reverse { 1.0 - tick_slow.fract() } else { tick_slow.fract() } as f32; let smooth = smootherstep(0.0, 1.0, tick_f); let a_weight = 1.0 - smooth; let b_weight = smooth; let tick_seg = -consts::PI / 2.0 - (-(consts::PI / 6.0) * a_weight + (consts::PI / 6.0) * b_weight); Point3::new(tick_seg.cos() as f32, ((tick / 2.0).sin() * 0.25 + 0.2) as f32, tick_seg.sin() as f32) } fn cam_pan_front(tick: f64) -> P3F { // Camera makes circular motion looking at the mesh Point3::new((tick.cos() * 0.3) as f32, (tick.sin() * 0.3) as f32 + 0.4, 1.7) } fn cam_pan_back(tick: f64) -> P3F { // Camera makes circular motion looking at the box (which is open at the back) Point3::new((tick.cos() * 0.3) as f32, (tick.sin() * 0.3) as f32, -2.0) } fn smootherstep(edge0: f32, edge1: f32, x: f32) -> f32 { // Scale and clamp x to 0..1 range let x = na::clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); // Evaluate polynomial x * x * x * (x * (x * 6.0 - 15.0) + 10.0) } // // ----------------------------- // Cube Map Loading & Processing // ----------------------------- // // All our irradiance cube map faces have the same fixed dimensions static CM_FACE_WDH: i32 = 64; #[derive(PartialEq, Debug, Copy, Clone)] enum CMFaceName { XPos, XNeg, YPos, YNeg, ZPos, ZNeg } // TODO: We could store the different convolution cube maps interleaved, // increasing cache usage for lookups using multiple powers type CMFace = Vec<V3F>; type CM = [CMFace; 6]; struct IrradianceCMSet { cos_0: CM, // Reflection map cos_1: CM, // Diffuse cos_8: CM, // Specular pow^x cos_64: CM, // .. cos_512: CM, // .. cross: Vec<u32>, // Image of unfolded LDR cube map cross cross_wdh: i32, // Width of cross cross_hgt: i32 // Height of cross } impl IrradianceCMSet { fn from_path(path: &str) -> IrradianceCMSet { // Build a full irradiance cube map set with preview from the files found in 'path' let path = &path.to_string(); println!("IrradianceCMSet::from_path(): Loading 5x6x{}x{} cube map faces of \ cos^[0|1|8|64|512] convolved irradiance from '{}'", CM_FACE_WDH, CM_FACE_WDH, path); // Low-res reflection map and LDR unfolded image let cos_0 = load_cm(0, path); let (cross, cross_wdh, cross_hgt) = draw_cm_cross_buffer(&cos_0); IrradianceCMSet { cos_0: cos_0, cos_1: load_cm(1, path), cos_8: load_cm(8, path), cos_64: load_cm(64, path), cos_512: load_cm(512, path), cross: cross, cross_wdh: cross_wdh, cross_hgt: cross_hgt } } fn draw_cross(&self, xorg: i32, yorg: i32, w: i32, h: i32, fb: *mut u32) { // Draw the cross image into the given framebuffer let x1 = na::clamp(xorg, 0, w); let y1 = na::clamp(yorg, 0, h); let x2 = cmp::min(x1 + self.cross_wdh, w); let y2 = cmp::min(y1 + self.cross_hgt, h); let cross_ptr = self.cross.as_ptr(); for y in y1..y2 { let cy = y - y1; let fb_row = y * w; let cross_row = cy * self.cross_wdh - x1; for x in x1..x2 { let c = unsafe { * cross_ptr.offset((cross_row + x) as isize) }; // Skip pixels not on the cross (alpha == 0) if c & 0xFF000000 == 0 { continue } unsafe { * fb.offset((fb_row + x) as isize) = c } } } } } fn load_hdr(file_name: &String) -> image::Image<f32> { // Load a Radiance HDR image using the stb_image library let path = path::Path::new(file_name); if !path.exists() { panic!("load_hdr(): File not found: {}", file_name) } match image::load(path) { image::LoadResult::ImageF32(img) => img, image::LoadResult::ImageU8(_) => panic!("load_hdr(): Not HDR: {}", file_name), image::LoadResult::Error(err) => panic!("load_hdr(): {}: {}", err, file_name) } } fn cm_fn_from_param(path: &String, power: i32, face: CMFaceName) -> String { // Construct a file name like 'data/env_cos_64_x+.hdr' from the given parameters let face_name = match face { CMFaceName::XPos => "x+", CMFaceName::XNeg => "x-", CMFaceName::YPos => "y+", CMFaceName::YNeg => "y-", CMFaceName::ZPos => "z+", CMFaceName::ZNeg => "z-" }.to_string(); format!("{}/env_cos_{}_{}.hdr", path, power, face_name) } fn load_cm_face(file_name: &String, flip_x: bool, flip_y: bool) -> CMFace { // Load HDR let img = load_hdr(&file_name); if img.width != CM_FACE_WDH as usize || img.height != CM_FACE_WDH as usize { panic!("load_cm_face(): HDR image has wrong cube map face dimensions: {}: {} x {}", file_name, img.width, img.height); } // Convert to our format, flip axis as requested let mut face = Vec::new(); face.resize((CM_FACE_WDH * CM_FACE_WDH) as usize, na::zero()); for y in 0..CM_FACE_WDH { for x in 0..CM_FACE_WDH { face[(if flip_x { CM_FACE_WDH - 1 - x } else { x } + if flip_y { CM_FACE_WDH - 1 - y } else { y } * CM_FACE_WDH) as usize] = Vector3::new(img.data[(x * 3 + y * CM_FACE_WDH * 3 + 0) as usize], img.data[(x * 3 + y * CM_FACE_WDH * 3 + 1) as usize], img.data[(x * 3 + y * CM_FACE_WDH * 3 + 2) as usize]); } } face } fn load_cm(power: i32, path: &String) -> CM { // Load all six cube map faces of the given power from the given path // The cube maps we load are oriented like OpenGL expects them, which is actually // rather strange. Flip and mirror so it's convenient for the way we do lookups [ load_cm_face(&cm_fn_from_param(path, power, CMFaceName::XPos), true , true ), load_cm_face(&cm_fn_from_param(path, power, CMFaceName::XNeg), false, true ), load_cm_face(&cm_fn_from_param(path, power, CMFaceName::YPos), false, false), load_cm_face(&cm_fn_from_param(path, power, CMFaceName::YNeg), false, true ), load_cm_face(&cm_fn_from_param(path, power, CMFaceName::ZPos), false, true ), load_cm_face(&cm_fn_from_param(path, power, CMFaceName::ZNeg), true , true ) ] } fn draw_cm_cross_buffer(cm: &CM) -> (Vec<u32>, i32, i32) { // Draw a flattened out cube map into a buffer, faces are half size // // _ _ (cross_wdh, cross_hgt) // | Y+ | // X- Z- X+ Z+ // |_ Y- _| // (0,0) // let faces = [ CMFaceName::XPos, CMFaceName::XNeg, CMFaceName::YPos, CMFaceName::YNeg, CMFaceName::ZPos, CMFaceName::ZNeg ]; let cross_wdh = 4 * (CM_FACE_WDH / 2); let cross_hgt = 3 * (CM_FACE_WDH / 2); let mut cross = Vec::new(); cross.resize((cross_wdh * cross_hgt) as usize, 0); for face_idx in faces.iter() { let face = &cm[*face_idx as usize]; // Our faces are oriented so we can most efficiently do vector lookups, not // necessarily in the right format for display, so we have to mirror and flip let (xoff, yoff, flip_x, flip_y) = match face_idx { &CMFaceName::XPos => (2, 1, false, false), &CMFaceName::XNeg => (0, 1, true , false), &CMFaceName::YPos => (1, 2, false, false), &CMFaceName::YNeg => (1, 0, false, true ), &CMFaceName::ZPos => (3, 1, true , false), &CMFaceName::ZNeg => (1, 1, false, false) }; let wdh_half = CM_FACE_WDH / 2; for yf in 0..wdh_half { for xf in 0..wdh_half { let x = xf + xoff * wdh_half; let y = yf + yoff * wdh_half; let col = face[( if flip_x { wdh_half - 1 - xf } else { xf } * 2 + if flip_y { wdh_half - 1 - yf } else { yf } * 2 * CM_FACE_WDH) as usize]; let idx = (x + y * cross_wdh) as usize; // We later use the alpha channel to skip pixels outside the cross cross[idx] = rgbf_to_abgr32_gamma(col.x, col.y, col.z) | 0xFF000000; } } } (cross, cross_wdh, cross_hgt) } fn cm_texel_from_dir(dir: &V3F) -> (CMFaceName, i32) { // Find the closest cube map texel pointed at by 'dir' let face; let mut u; let mut v; let dir_abs = Vector3::new(dir.x.abs(), dir.y.abs(), dir.z.abs()); // Find major axis if dir_abs.x > dir_abs.y && dir_abs.x > dir_abs.z { face = if dir.x > 0.0 { CMFaceName::XPos } else { CMFaceName::XNeg }; let inv_dir_abs = 1.0 / dir_abs.x; u = dir.z * inv_dir_abs; v = dir.y * inv_dir_abs; } else if dir_abs.y > dir_abs.x && dir_abs.y > dir_abs.z { face = if dir.y > 0.0 { CMFaceName::YPos } else { CMFaceName::YNeg }; let inv_dir_abs = 1.0 / dir_abs.y; u = dir.x * inv_dir_abs; v = dir.z * inv_dir_abs; } else { face = if dir.z > 0.0 { CMFaceName::ZPos } else { CMFaceName::ZNeg }; let inv_dir_abs = 1.0 / dir_abs.z; u = dir.x * inv_dir_abs; v = dir.y * inv_dir_abs; } // Face texel coordinates u = (u + 1.0) * 0.5; v = (v + 1.0) * 0.5; let tx = na::clamp((u * CM_FACE_WDH as f32) as i32, 0, CM_FACE_WDH - 1); let ty = na::clamp((v * CM_FACE_WDH as f32) as i32, 0, CM_FACE_WDH - 1); (face, tx + ty * CM_FACE_WDH) } fn lookup_texel_cm(cm: &CM, texel: (CMFaceName, i32)) -> V3F { let (face, idx) = texel; unsafe { *cm.get_unchecked(face as usize).get_unchecked(idx as usize) } } fn lookup_dir_cm(cm: &CM, dir: &V3F) -> V3F { lookup_texel_cm(cm, cm_texel_from_dir(dir)) } #[allow(dead_code)] fn cm_texel_to_dir(face: CMFaceName, x: i32, y: i32) -> V3F { // Convert a texel position on a cube map face into a direction let vw = (x as f32 + 0.5) / CM_FACE_WDH as f32 * 2.0 - 1.0; let vh = (y as f32 + 0.5) / CM_FACE_WDH as f32 * 2.0 - 1.0; na::normalize(&match face { CMFaceName::XPos => V3F::new( 1.0, vh, vw), CMFaceName::XNeg => V3F::new(-1.0, vh, vw), CMFaceName::YPos => V3F::new( vw, 1.0, vh), CMFaceName::YNeg => V3F::new( vw, -1.0, vh), CMFaceName::ZPos => V3F::new( vw, vh, 1.0), CMFaceName::ZNeg => V3F::new( vw, vh, -1.0) }) } // Normalization cube map, used as a lookup table for vector normalization lazy_static! { static ref _CM_NORMALIZE:[Vec<V3F>; 6] = { let build_face = |face: CMFaceName| -> Vec<V3F> { let mut v: Vec<V3F> = Vec::new(); v.resize((CM_FACE_WDH * CM_FACE_WDH) as usize, V3F::new(0.0, 0.0, 0.0)); for y in 0..CM_FACE_WDH { for x in 0..CM_FACE_WDH { v[(x + y * CM_FACE_WDH) as usize] = cm_texel_to_dir(face, x, y); } } v }; [ build_face(CMFaceName::XPos), build_face(CMFaceName::XNeg), build_face(CMFaceName::YPos), build_face(CMFaceName::YNeg), build_face(CMFaceName::ZPos), build_face(CMFaceName::ZNeg) ] }; } #[no_mangle] pub extern fn rast_get_num_cm_sets() -> i32 { 9 } #[no_mangle] pub extern fn rast_get_cm_set_name(idx: i32) -> *const u8 { cm_set_by_idx(idx).0.as_ptr() } fn cm_set_by_idx<'a>(idx: i32) -> (&'a str, &'a IrradianceCMSet) { // Retrieve irradiance cube map set name and images by its index. We do this in such // an awkward way so we can take advantage of the on-demand loading of the cube maps // through lazy_static // Sets of pre-filtered irradiance cube maps lazy_static! { static ref CM_GRACE: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/grace" ); static ref CM_PARKING_LOT: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/parking_lot"); static ref CM_ENIS: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/enis" ); static ref CM_GLACIER: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/glacier" ); static ref CM_PISA: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/pisa" ); static ref CM_PINE_TREE: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/pine_tree" ); static ref CM_UFFIZI: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/uffizi" ); static ref CM_DOGE: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/doge" ); static ref CM_COLTEST: IrradianceCMSet = IrradianceCMSet::from_path("envmaps/coltest/" ); } match idx { // Null terminated names so we can easily pass them as C strings 0 => ("Grace\0" , &CM_GRACE ), 1 => ("ParkingLot\0", &CM_PARKING_LOT), 2 => ("Enis\0" , &CM_ENIS ), 3 => ("Glacier\0" , &CM_GLACIER ), 4 => ("Pisa\0" , &CM_PISA ), 5 => ("PineTree\0" , &CM_PINE_TREE ), 6 => ("Uffizi\0" , &CM_UFFIZI ), 7 => ("Doge\0" , &CM_DOGE ), 8 => ("ColTest\0" , &CM_COLTEST ), _ => panic!("cm_set_by_idx: Invalid index: {}", idx) } } // // ------- // Shaders // ------- // // All shaders have this signature type Shader = fn(&V3F, // World space position &V3F, // World space normal &V3F, // Color (usually baked AO / radiosity) &P3F, // World space camera position f64, // Current time (tick) &IrradianceCMSet) -> // Current environment cube map set V3F; // Output color fn shader_color(_: &V3F, _: &V3F, col: &V3F, _: &P3F, _: f64, _: &IrradianceCMSet) -> V3F { *col } fn shader_n_to_color(_: &V3F, n: &V3F, _: &V3F, _: &P3F, _: f64, _: &IrradianceCMSet) -> V3F { // Convert the normal to a color (n.normalize() + 1.0) * 0.5 } fn shader_headlight(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _: f64, _: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let l = fast_normalize(&(*eye.as_vector() - *p)); let ldotn = na::clamp(na::dot(&l, &n), 0.0, 1.0); let occlusion = *col * *col; occlusion * ldotn } fn shader_dir_light(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, _cm: &IrradianceCMSet) -> V3F { // Specular material lit by two light sources let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = fast_normalize(&reflect(&eye, &n)); let l = Vector3::new(0.577350269, 0.577350269, 0.577350269); // Normalized (1, 1, 1) let light_1 = { let ldotn = na::clamp(na::dot(&l, &n), 0.0, 1.0); let ldotr = fast_unit_pow16(na::clamp(na::dot(&l, &r), 0.0, 1.0)); ldotn * 0.25 + ldotr * 0.75 }; let light_2 = { let ldotn = na::clamp(na::dot(&-l, &n), 0.0, 1.0); let ldotr = fast_unit_pow16(na::clamp(na::dot(&-l, &r), 0.0, 1.0)); ldotn * 0.25 + ldotr * 0.75 }; let ambient = Vector3::new(0.05, 0.05, 0.05); let light = Vector3::new(1.0, 0.5, 0.5) * light_1 + Vector3::new(0.5, 0.5, 1.0) * light_2 + ambient; let occlusion = *col * *col; light * occlusion } fn normalize_phong_lobe(power: f32) -> f32 { (power + 2.0) * 0.5 } fn shader_cm_diffuse(_p: &V3F, n: &V3F, col: &V3F, _eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); lookup_dir_cm(&cm.cos_1, &n) * (*col * *col) } fn shader_cm_refl(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let r_tex = cm_texel_from_dir(&r); ( lookup_dir_cm (&cm.cos_1 , &n) + lookup_texel_cm(&cm.cos_8 , r_tex) * normalize_phong_lobe(8.0 ) + lookup_texel_cm(&cm.cos_64, r_tex) * normalize_phong_lobe(64.0) ) * (*col * *col) } fn shader_cm_coated(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let r_tex = cm_texel_from_dir(&r); let fresnel = fresnel_conductor(na::dot(&-eye, &n), 1.0, 1.1); ( lookup_dir_cm (&cm.cos_1 , &n) * 0.85 + lookup_texel_cm(&cm.cos_8 , r_tex) * normalize_phong_lobe(8.0 ) * fresnel + lookup_texel_cm(&cm.cos_512, r_tex) * normalize_phong_lobe(512.0) * fresnel * 1.5 ) * (*col * *col) } fn shader_cm_diff_rim(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let fresnel = fresnel_conductor(na::dot(&-eye, &n), 1.0, 1.1); (lookup_dir_cm(&cm.cos_1, &n) + fresnel * 0.75) * *col } fn shader_cm_glossy(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); ( lookup_dir_cm(&cm.cos_1, &n) + lookup_dir_cm(&cm.cos_8, &r) * normalize_phong_lobe(8.0) ) * (*col * *col) } fn shader_cm_green_highlight(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); ( lookup_dir_cm(&cm.cos_1 , &n) + lookup_dir_cm(&cm.cos_64, &r) * normalize_phong_lobe(64.0) * Vector3::new(0.2, 0.8, 0.2) ) * (*col * *col) } fn shader_cm_red_material(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); ( lookup_dir_cm(&cm.cos_1 , &n) * Vector3::new(0.8, 0.2, 0.2) + lookup_dir_cm(&cm.cos_512, &r) * normalize_phong_lobe(512.0) ) * (*col * *col) } fn shader_cm_metallic(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let r_tex = cm_texel_from_dir(&r); ( lookup_texel_cm(&cm.cos_8 , r_tex) * normalize_phong_lobe(8.0 ) + lookup_texel_cm(&cm.cos_64, r_tex) * normalize_phong_lobe(64.0) ) * (*col) } fn shader_cm_super_shiny(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let r_tex = cm_texel_from_dir(&r); ( lookup_texel_cm(&cm.cos_64 , r_tex) * normalize_phong_lobe(64.0 ) + lookup_texel_cm(&cm.cos_512, r_tex) * normalize_phong_lobe(512.0) + lookup_texel_cm(&cm.cos_0 , r_tex) ) * (*col) } fn shader_cm_gold(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let l = fast_normalize(&(*eye.as_vector() - *p)); let ldotn = na::clamp(na::dot(&l, &n), 0.0, 1.0); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let albedo = Vector3::new(1.0, 0.76, 0.33); let r_tex = cm_texel_from_dir(&r); ( lookup_dir_cm (&cm.cos_1 , &n) * ldotn + lookup_texel_cm(&cm.cos_8 , r_tex) * normalize_phong_lobe(8.0 ) + lookup_texel_cm(&cm.cos_512, r_tex) * normalize_phong_lobe(512.0) * (1.0 - ldotn) ) * albedo * (*col * *col) } fn shader_cm_blue(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let l = fast_normalize(&(*eye.as_vector() - *p)); let ldotn = na::clamp(na::dot(&l, &n), 0.0, 1.0); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let r_tex = cm_texel_from_dir(&r); ( lookup_dir_cm (&cm.cos_1 , &n) * Vector3::new(0.2, 0.2, 0.8) * ldotn + lookup_texel_cm(&cm.cos_64 , r_tex) * normalize_phong_lobe(64.0 ) * 0.75 + lookup_texel_cm(&cm.cos_512, r_tex) * normalize_phong_lobe(512.0) * (1.0 - ldotn) ) * (*col * *col) } fn shader_cm_blinn_schlick(p: &V3F, n: &V3F, col: &V3F, eye: &P3F, _tick: f64, cm: &IrradianceCMSet) -> V3F { let n = fast_normalize(n); let eye = *p - *eye.as_vector(); let r = reflect(&eye, &n); let h = (n + r) / (n + r).norm(); let w = 1.0 - na::clamp(na::dot(&h, &eye), 0.0, 1.0); let w = w * w; ( lookup_dir_cm(&cm.cos_1 , &n) * V3F::new(0.8, 0.65, 1.0) * w + (lookup_dir_cm(&cm.cos_64, &h) * normalize_phong_lobe(64.0) * (1.25 - w)) ) * (*col * *col) } fn fresnel_conductor( cosi: f32, // Cosine between normal and incident ray eta: f32, // Index of refraction k: f32) // Absorption coefficient -> f32 { // Compute Fresnel term for a conductor, PBRT 1st edition p422 // Material | Eta | K // ------------------------ // Gold | 0.370 | 2.820 // Silver | 0.177 | 3.638 // Copper | 0.617 | 2.63 // Steel | 2.485 | 3.433 let tmp = (eta * eta + k * k) * cosi * cosi; let r_parallel_2 = (tmp - (2.0 * eta * cosi) + 1.0) / (tmp + (2.0 * eta * cosi) + 1.0); let tmp_f = eta * eta + k * k; let r_perpend_2 = (tmp_f - (2.0 * eta * cosi) + cosi * cosi) / (tmp_f + (2.0 * eta * cosi) + cosi * cosi); (r_parallel_2 + r_perpend_2) / 2.0 } fn fast_unit_pow16(v: f32) -> f32 { // Fast X^16 function for X e [0, 1] using a 256 entry lookup table // // Table generation: // // for i in 600..256 + 600 { // let v = i as f32 / (600.0 + 255.0); // println!("{:<12},", v.powf(16.0)); // } // // Table is shifted so more entries are used for the larger values, useful when // dealing with floats that will be converted to 8bit color values static TBL: [f32; 256] = [ 0.003459093 , 0.003552495 , 0.0036482627, 0.0037464416, 0.0038470984, 0.003950281 , 0.0040560593, 0.004164483 , 0.004275625 , 0.004389537 , 0.004506296 , 0.0046259556, 0.004748595 , 0.0048742713, 0.005003067 , 0.005135042 , 0.005270282 , 0.005408848 , 0.0055508246, 0.0056962967, 0.0058453293, 0.005998019 , 0.006154434 , 0.006314675 , 0.0064788125, 0.006646952 , 0.006819167 , 0.0069955676, 0.0071762297, 0.0073612686, 0.0075507634, 0.0077448343, 0.007943563 , 0.008147076 , 0.008355458 , 0.00856884 , 0.008787312 , 0.009010997 , 0.009240023 , 0.009474486 , 0.00971453 , 0.009960255 , 0.01021181 , 0.010469298 , 0.010732877 , 0.011002653 , 0.011278792 , 0.011561403 , 0.011850657 , 0.012146669 , 0.012449619 , 0.012759625 , 0.0130768735, 0.013401488 , 0.013733663 , 0.0140735265, 0.014421281 , 0.0147770615, 0.015141058 , 0.015513466 , 0.015894428 , 0.016284168 , 0.016682833 , 0.017090656 , 0.017507788 , 0.017934473 , 0.018370869 , 0.018817227 , 0.019273717 , 0.019740595 , 0.020218033 , 0.020706309 , 0.021205597 , 0.02171618 , 0.022238243 , 0.022772085 , 0.023317892 , 0.023875948 , 0.024446534 , 0.025029855 , 0.025626237 , 0.026235888 , 0.026859147 , 0.027496237 , 0.028147504 , 0.028813178 , 0.029493624 , 0.030189078 , 0.030899918 , 0.03162639 , 0.03236889 , 0.03312767 , 0.033903137 , 0.03469556 , 0.03550536 , 0.036332812 , 0.03717832 , 0.03804229 , 0.038925007 , 0.03982695 , 0.040748402 , 0.04168987 , 0.042651646 , 0.043634243 , 0.04463798 , 0.04566339 , 0.046710797 , 0.047780745 , 0.048873585 , 0.04998988 , 0.051129986 , 0.052294493 , 0.05348377 , 0.05469843 , 0.05593885 , 0.05720567 , 0.05849928 , 0.059820276 , 0.06116927 , 0.06254667 , 0.06395318 , 0.06538923 , 0.06685554 , 0.06835256 , 0.06988104 , 0.07144143 , 0.073034525 , 0.0746608 , 0.07632106 , 0.0780158 , 0.07974585 , 0.081511736 , 0.08331432 , 0.08515413 , 0.08703208 , 0.0889487 , 0.09090483 , 0.09290134 , 0.0949388 , 0.097018205 , 0.09914013 , 0.10130563 , 0.10351528 , 0.105770186 , 0.108070955 , 0.1104187 , 0.112814076 , 0.115258224 , 0.11775182 , 0.12029606 , 0.122891635 , 0.12553978 , 0.1282412 , 0.1309972 , 0.1338085 , 0.13667643 , 0.13960177 , 0.14258571 , 0.14562954 , 0.14873405 , 0.15190066 , 0.15513025 , 0.15842429 , 0.16178365 , 0.16520987 , 0.16870385 , 0.1722672 , 0.17590083 , 0.17960641 , 0.18338488 , 0.18723798 , 0.19116667 , 0.19517274 , 0.19925721 , 0.20342192 , 0.20766792 , 0.21199688 , 0.21641058 , 0.22091007 , 0.2254974 , 0.23017366 , 0.23494098 , 0.23980048 , 0.24475436 , 0.2498038 , 0.25495103 , 0.2601973 , 0.26554492 , 0.27099517 , 0.27655044 , 0.28221205 , 0.2879825 , 0.2938631 , 0.29985642 , 0.3059639 , 0.31218818 , 0.31853068 , 0.32499382 , 0.3315801 , 0.33829102 , 0.34512943 , 0.35209695 , 0.3591965 , 0.36642978 , 0.37379977 , 0.3813082 , 0.38895822 , 0.39675155 , 0.4046915 , 0.4127798 , 0.4210199 , 0.4294136 , 0.4379644 , 0.4466742 , 0.45554665 , 0.46458364 , 0.47378847 , 0.48316458 , 0.49271393 , 0.5024405 , 0.5123463 , 0.52243555 , 0.5327103 , 0.5431748 , 0.5538312 , 0.564684 , 0.5757353 , 0.58698964 , 0.59844947 , 0.61011934 , 0.6220017 , 0.6341014 , 0.64642084 , 0.65896505 , 0.67173654 , 0.6847404 , 0.6979794 , 0.711458 , 0.7251811 , 0.73915136 , 0.7533743 , 0.7678528 , 0.78259254 , 0.7975965 , 0.81287056 , 0.8284178 , 0.8442442 , 0.86035293 , 0.87675035 , 0.8934395 , 0.91042703 , 0.9277161 , 0.9453135 , 0.96322256 , 0.98145026 , 1.0 ]; let idx = (v * 855.0 - 600.0) as i32; if idx < 0 { 0.0 } else { if idx > 255 { 1.0 } else { unsafe { * TBL.get_unchecked(idx as usize) } } } } #[no_mangle] pub extern fn rast_get_num_shaders() -> i32 { 16 } #[no_mangle] pub extern fn rast_get_shader_name(idx: i32) -> *const u8 { shader_by_idx(idx).0.as_ptr() } fn shader_by_idx<'a>(idx: i32) -> (&'a str, bool, Shader) { // Retrieve shader name, cube map usage and function by its index let shaders: [(&str, bool, Shader); 16] = [ // Null terminated names so we can easily pass them as C strings ("BakedColor\0" , false, shader_color ), ("Normals\0" , false, shader_n_to_color ), ("Headlight\0" , false, shader_headlight ), ("Plastic2xDirLight\0", false, shader_dir_light ), ("CMDiffuse\0" , true , shader_cm_diffuse ), ("CMRefl\0" , true , shader_cm_refl ), ("CMCoated\0" , true , shader_cm_coated ), ("CMDiffRim\0" , true , shader_cm_diff_rim ), ("CMGlossy\0" , true , shader_cm_glossy ), ("CMGreenHighlight\0" , true , shader_cm_green_highlight), ("CMRedMaterial\0" , true , shader_cm_red_material ), ("CMMetallic\0" , true , shader_cm_metallic ), ("CMSuperShiny\0" , true , shader_cm_super_shiny ), ("CMGold\0" , true , shader_cm_gold ), ("CMBlue\0" , true , shader_cm_blue ), ("CMBlinnSchlick\0" , true , shader_cm_blinn_schlick ) ]; assert!(rast_get_num_shaders() as usize == shaders.len()); if idx as usize >= shaders.len() { panic!("shader_by_idx: Invalid index: {}", idx) } shaders[idx as usize] } // // ---------------------------------- // Vertex Processing & Transformation // ---------------------------------- // struct TransformedVertex { vp: Point4<f32>, // Projected, perspective divided, viewport transformed vertex with W // (note that we actually store 1/W in the last component) world: V3F, // World space vertex and normal for lighting computations etc. n: V3F, // ... col: V3F // Color } fn transform_vertices(vtx_in: &[Vertex], vtx_out: &mut [TransformedVertex], normalize_mesh_dimensions: &Matrix4<f32>, w: i32, h: i32, eye: &P3F) { // Build a mesh to viewport transformation and write out a transformed set of vertices // Build transformations (TODO: We do this for each chunk of vertices processed) let mesh_to_world = *normalize_mesh_dimensions; let world_to_view = look_at(eye, &Point3::new(0.0, 0.0, 0.0), &Vector3::y()); let view_to_proj = perspective(45.0, w as f32 / h as f32, 0.1, 10.0); let wh = w as f32 / 2.0; let hh = h as f32 / 2.0; // TODO: We're applying the viewport transform before the // perspective divide, why does this actually work // identically to doing it right after it below? let proj_to_vp = Matrix4::new(wh, 0.0, 0.0, wh, 0.0, hh, 0.0, hh, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0); let world_to_vp = proj_to_vp * view_to_proj * world_to_view; let mesh_to_world_it_33 = na::from_homogeneous::<Matrix4<f32>, Matrix3<f32>> (&mesh_to_world.inverse().unwrap().transpose()); // Transform and copy into target slice instead of copy and transform in-place for (src, dst) in vtx_in.iter().zip(vtx_out.iter_mut()) { // Transform from mesh into world space let world_h: Point4<f32> = mesh_to_world * na::to_homogeneous(&src.p); dst.world = Vector3::new(world_h.x, world_h.y, world_h.z); // World to viewport. Note that we do the perspective divide manually instead of using // dst = na::from_homogeneous(&(transf * na::to_homogeneous(&src))); // so we can keep W around dst.vp = world_to_vp * world_h; let inv_w = 1.0 / dst.vp.w; dst.vp.x *= inv_w; dst.vp.y *= inv_w; dst.vp.z *= inv_w; // We need 1/w for the perspective correct attribute interpolation, // just store the reciprocal we already computed dst.vp.w = inv_w; // Multiply with the 3x3 IT for world space normals dst.n = mesh_to_world_it_33 * src.n; // Copy color dst.col = src.col; } } // The camera related functions in nalgebra like Isometry3::look_at_z() and PerspMat3::new() // are all using some rather unusual conventions and are not documented. Replace them with // custom variants that work like the usual OpenGL style versions fn look_at(eye: &P3F, at: &P3F, up: &V3F) -> Matrix4<f32> { let zaxis = na::normalize(&(*eye - *at)); let xaxis = na::normalize(&na::cross(up, &zaxis)); let yaxis = na::cross(&zaxis, &xaxis); Matrix4::new(xaxis.x, xaxis.y, xaxis.z, na::dot(&-eye.to_vector(), &xaxis), yaxis.x, yaxis.y, yaxis.z, na::dot(&-eye.to_vector(), &yaxis), zaxis.x, zaxis.y, zaxis.z, na::dot(&-eye.to_vector(), &zaxis), 0.0, 0.0, 0.0, 1.0) } fn perspective(fovy_deg: f32, aspect: f32, near: f32, far: f32) -> Matrix4<f32> { let tan_half_fovy = (deg_to_rad(fovy_deg) / 2.0).tan(); let m00 = 1.0 / (aspect * tan_half_fovy); let m11 = 1.0 / tan_half_fovy; let m22 = -(far + near) / (far - near); let m23 = -(2.0 * far * near) / (far - near); let m32 = -1.0; Matrix4::new(m00, 0.0, 0.0, 0.0, 0.0, m11, 0.0, 0.0, 0.0, 0.0, m22, m23, 0.0, 0.0, m32, 0.0) } // // --------------------- // Miscellaneous Drawing // --------------------- // #[no_mangle] pub extern fn rast_get_num_backgrounds() -> i32 { 5 } fn draw_bg_gradient(bg_idx: i32, w: i32, h: i32, fb: *mut u32) { // Fill the framebuffer with a vertical gradient let start; let end; match bg_idx { 0 => { start = Vector3::new(0.3, 0.3, 0.3); end = Vector3::new(0.7, 0.7, 0.7); } 1 => { start = Vector3::new(1.0, 0.4, 0.0); end = Vector3::new(0.0, 0.5, 0.5); } 2 => { start = Vector3::new(1.0, 0.0, 1.0); end = Vector3::new(1.0, 0.0, 1.0); } 3 => { start = Vector3::new(1.0, 1.0, 1.0); end = Vector3::new(1.0, 1.0, 1.0); } 4 => { start = Vector3::new(0.0, 0.0, 0.0); end = Vector3::new(0.0, 0.0, 0.0); } _ => panic!("draw_bg_gradient: Invalid index: {}", bg_idx) } for y in 0..h { let pos = y as f32 / (h - 1) as f32; let col = start * (1.0 - pos) + end * pos; // No gamma. The gradients look nice without it, as it's more perceptually linear // this way. It's also faster let col32 = rgbf_to_abgr32(col.x, col.y, col.z); let fb_row = unsafe { fb.offset((y * w) as isize) }; for x in 0..w { unsafe { * fb_row.offset(x as isize) = col32; } } } } fn draw_line(x1: f32, y1: f32, x2: f32, y2: f32, fb: *mut u32, w: i32, h: i32) { // Draw a line using the DDA algorithm // Just so edges with same vertices but different winding get the same coordinates let (x1, y1, x2, y2) = if x2 > x1 { (x1, y1, x2, y2) } else { (x2, y2, x1, y1) }; let dx = x2 - x1; let dy = y2 - y1; let s = if dx.abs() > dy.abs() { dx.abs() } else { dy.abs() }; let xi = dx / s; let yi = dy / s; let mut x = x1; let mut y = y1; let mut m = 0.0; while m < s { let xr = x as i32; let yr = y as i32; if xr >= 0 && xr < w && yr >= 0 && yr < h { let idx = xr + yr * w; unsafe { * fb.offset(idx as isize) = 0x00FFFFFF } } x += xi; y += yi; m += 1.0; } } // // ------------------ // Framebuffer Output // ------------------ // fn rgbf_to_abgr32(r: f32, g: f32, b: f32) -> u32 { // Clamp and covert floating-point RGB triplet to a packed ABGR32, no gamma correction let r8 = (na::clamp(r, 0.0, 1.0) * 255.0) as u32; let g8 = (na::clamp(g, 0.0, 1.0) * 255.0) as u32; let b8 = (na::clamp(b, 0.0, 1.0) * 255.0) as u32; r8 | (g8 << 8) | (b8 << 16) } fn rgbf_to_abgr32_gamma(r: f32, g: f32, b: f32) -> u32 { // Clamp, gamma correct and covert floating-point RGB triplet to a packed ABGR32 // value. Doing gamma correction in full float precision is very expensive due to the // pow() calls. 8bit introduces severe banding. A 11bit LUT is a good compromise let r11_idx = (r * 2047.0) as i32; let g11_idx = (g * 2047.0) as i32; let b11_idx = (b * 2047.0) as i32; let r8 = if r11_idx < 0 { 0 } else { if r11_idx > 2047 { 255 } else { unsafe { * GAMMA_11BIT_LUT.get_unchecked(r11_idx as usize) as u32 } } }; let g8 = if g11_idx < 0 { 0 } else { if g11_idx > 2047 { 255 } else { unsafe { * GAMMA_11BIT_LUT.get_unchecked(g11_idx as usize) as u32 } } }; let b8 = if r11_idx < 0 { 0 } else { if b11_idx > 2047 { 255 } else { unsafe { * GAMMA_11BIT_LUT.get_unchecked(b11_idx as usize) as u32 } } }; r8 | (g8 << 8) | (b8 << 16) } // 11bit gamma 2.2 correction LUT, fits in 2KB and just about good enough // // for i in 0..2048 { // println!("{:<3},", ((i as f32 / 2047.0).powf(1.0 / 2.2) * 255.0).round() as u8); // } static GAMMA_11BIT_LUT: [u8; 2048] = [ 0 , 8 , 11 , 13 , 15 , 17 , 18 , 19 , 21 , 22 , 23 , 24 , 25 , 26 , 26 , 27 , 28 , 29 , 30 , 30 , 31 , 32 , 32 , 33 , 34 , 34 , 35 , 36 , 36 , 37 , 37 , 38 , 39 , 39 , 40 , 40 , 41 , 41 , 42 , 42 , 43 , 43 , 44 , 44 , 45 , 45 , 45 , 46 , 46 , 47 , 47 , 48 , 48 , 48 , 49 , 49 , 50 , 50 , 50 , 51 , 51 , 52 , 52 , 52 , 53 , 53 , 54 , 54 , 54 , 55 , 55 , 55 , 56 , 56 , 56 , 57 , 57 , 57 , 58 , 58 , 58 , 59 , 59 , 59 , 60 , 60 , 60 , 61 , 61 , 61 , 62 , 62 , 62 , 63 , 63 , 63 , 63 , 64 , 64 , 64 , 65 , 65 , 65 , 66 , 66 , 66 , 66 , 67 , 67 , 67 , 68 , 68 , 68 , 68 , 69 , 69 , 69 , 69 , 70 , 70 , 70 , 71 , 71 , 71 , 71 , 72 , 72 , 72 , 72 , 73 , 73 , 73 , 73 , 74 , 74 , 74 , 74 , 75 , 75 , 75 , 75 , 76 , 76 , 76 , 76 , 77 , 77 , 77 , 77 , 77 , 78 , 78 , 78 , 78 , 79 , 79 , 79 , 79 , 80 , 80 , 80 , 80 , 81 , 81 , 81 , 81 , 81 , 82 , 82 , 82 , 82 , 83 , 83 , 83 , 83 , 83 , 84 , 84 , 84 , 84 , 84 , 85 , 85 , 85 , 85 , 86 , 86 , 86 , 86 , 86 , 87 , 87 , 87 , 87 , 87 , 88 , 88 , 88 , 88 , 88 , 89 , 89 , 89 , 89 , 89 , 90 , 90 , 90 , 90 , 90 , 91 , 91 , 91 , 91 , 91 , 92 , 92 , 92 , 92 , 92 , 93 , 93 , 93 , 93 , 93 , 93 , 94 , 94 , 94 , 94 , 94 , 95 , 95 , 95 , 95 , 95 , 96 , 96 , 96 , 96 , 96 , 96 , 97 , 97 , 97 , 97 , 97 , 98 , 98 , 98 , 98 , 98 , 98 , 99 , 99 , 99 , 99 , 99 , 99 , 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 130, 130, 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, 136, 136, 137, 137, 137, 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 ]; // // ---------- // Rasterizer // ---------- // macro_rules! mk_rasterizer { ($shade_per_pixel: expr, $rast_fn_name: ident) => { #[inline(always)] fn $rast_fn_name(// Triangle vtx0: &TransformedVertex, vtx1: &TransformedVertex, vtx2: &TransformedVertex, // Parameters for shading shader: &Shader, eye: &P3F, tick: f64, cm: &IrradianceCMSet, // Active tile / scissor rect tx1: i32, ty1: i32, tx2: i32, ty2: i32, // Frame and depth buffer fb_stride: i32, fb: *mut u32, depth_ptr: *mut f32) { // TODO: This code would really benefit from SIMD intrinsics // Break out positions (viewport and world), colors and normals let v0 = vtx0.vp; let p0 = vtx0.world; let c0 = vtx0.col; let n0 = vtx0.n; let v1 = vtx1.vp; let p1 = vtx1.world; let c1 = vtx1.col; let n1 = vtx1.n; let v2 = vtx2.vp; let p2 = vtx2.world; let c2 = vtx2.col; let n2 = vtx2.n; // Convert to 28.4 fixed-point. It would be most accurate to round() on these values, // but that is extremely slow. Truncate will do, we're at most a sub-pixel off let x0 = (v0.x * 16.0) as i32; let y0 = (v0.y * 16.0) as i32; let x1 = (v1.x * 16.0) as i32; let y1 = (v1.y * 16.0) as i32; let x2 = (v2.x * 16.0) as i32; let y2 = (v2.y * 16.0) as i32; // Edge deltas let dx10 = x1 - x0; let dy01 = y0 - y1; let dx21 = x2 - x1; let dy12 = y1 - y2; let dx02 = x0 - x2; let dy20 = y2 - y0; // Backface culling through cross product. The Z component of the resulting vector // tells us if the triangle is facing the camera or not, its magnitude is the 2x the // signed area of the triangle, which is exactly what we need to normalize our // barycentric coordinates later let tri_a2 = (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0); if tri_a2 <= 0 { return } let inv_tri_a2 = 1.0 / tri_a2 as f32; // We test triangle coverage at integer coordinates D3D9 style vs centers like >=D3D10 // and OpenGL. Our pixel center is at the bottom-left. We also use a bottom-left fill // convention, unlike the more conventional top-left one. It's what D3D does, but with // the Y axis flipped (our origin is bottom-left). We normally consider only raster // positions as on the inside of an edge if the half-space function returns a positive // value. For the bottom-left edges we want the contested raster positions lying on // the edge to belong to its triangle. // // Consider these two 2x2 triangulated quads and how they'd rasterize with each convention // // *--*--* top-left bottom-left // |2 /| // * * * 2 2 . . // |/ 3| 2 3 2 3 // *--*--* 0 0 3 3 // |0 /| 0 1 0 1 // * * * . . 1 1 // |/ 1| // *--*--* // // With a bottom-left coordinate system origin and pixel center the latter fill convention // just makes more sense to me. No need to shift our AABB's Y by one and we can just round // up on both min / max bound // AABB of the triangle, map to pixels by rounding up let min_x = (min3(x0, x1, x2) + 0xF) >> 4; let min_y = (min3(y0, y1, y2) + 0xF) >> 4; let max_x = (max3(x0, x1, x2) + 0xF) >> 4; let max_y = (max3(y0, y1, y2) + 0xF) >> 4; // Clip against tile (which we assume to be inside the framebuffer) let min_x = cmp::max(min_x, tx1); let min_y = cmp::max(min_y, ty1); let max_x = cmp::min(max_x, tx2); let max_y = cmp::min(max_y, ty2); // Early reject for triangles which are outside the tile if max_x <= min_x || max_y <= min_y { return } // Implement bottom-left fill convention. Classifying those edges is simple, as with // CCW vertex order they are either descending or horizontally moving left to right. // We basically want to turn the '> 0' comparison into '>= 0', and we do this by adding // a constant 1 for the half-space functions of those edges let e0add = if dy01 > 0 || (dy01 == 0 && dx10 > 0) { 1 } else { 0 }; let e1add = if dy12 > 0 || (dy12 == 0 && dx21 > 0) { 1 } else { 0 }; let e2add = if dy20 > 0 || (dy20 == 0 && dx02 > 0) { 1 } else { 0 }; // We take the obvious formulation of the cross product edge functions // // hs0 = (x1 - x0) * (yf - y0) - (y1 - y0) * (xf - x0) // hs1 = (x2 - x1) * (yf - y1) - (y2 - y1) * (xf - x1) // hs2 = (x0 - x2) * (yf - y2) - (y0 - y2) * (xf - x2) // // and transform it into something more easily split based on its dependencies // // hs0 = (y0 - y1) * xf + (x1 - x0) * yf + (x0 * y1 - y0 * x1) // hs1 = (y1 - y2) * xf + (x2 - x1) * yf + (x1 * y2 - y1 * x2) // hs2 = (y2 - y0) * xf + (x0 - x2) * yf + (x2 * y0 - y2 * x0) // // Now we can separate the constant part and split the x/y dependent terms into an // initial value and one to add for every step in each loop direction // Edge function constant. The '+ 1' is so we can change the inside-edge compare in // the inner loop from > to >=, meaning we can just OR the signs of the edge functions let e0c = x0 * y1 - y0 * x1 + e0add + 1; let e1c = x1 * y2 - y1 * x2 + e1add + 1; let e2c = x2 * y0 - y2 * x0 + e2add + 1; // Starting value at AABB origin let mut e0y = dy01 * (min_x << 4) + dx10 * (min_y << 4) + e0c; let mut e1y = dy12 * (min_x << 4) + dx21 * (min_y << 4) + e1c; let mut e2y = dy20 * (min_x << 4) + dx02 * (min_y << 4) + e2c; // Fixed-point edge deltas (another shift because each pixel step is // 1 << 4 steps for the edge function) let fp_dx10 = dx10 << 4; let fp_dy01 = dy01 << 4; let fp_dx21 = dx21 << 4; let fp_dy12 = dy12 << 4; let fp_dx02 = dx02 << 4; let fp_dy20 = dy20 << 4; // During vertex processing we already replaced w with 1/w let inv_w_0 = v0.w; let inv_w_1 = v1.w; let inv_w_2 = v2.w; // Setup deltas for interpolating z, w and c with // // v0 + (v1 - v0) * b2 + (v2 - v0) * b0 // // instead of // // v0 * b1 + v1 * b2 + v2 * b0 let z10 = v1.z - v0.z; let z20 = v2.z - v0.z; let w10 = inv_w_1 - inv_w_0; let w20 = inv_w_2 - inv_w_0; let c10 = c1 * inv_w_1 - c0 * inv_w_0; let c20 = c2 * inv_w_2 - c0 * inv_w_0; for y in min_y..max_y { // Starting point for X stepping // // TODO: We could move the starting point to the intersection with the left edges, // turning this a bit into a scanline rasterizer let mut e0x = e0y; let mut e1x = e1y; let mut e2x = e2y; let idx_y = y * fb_stride; let mut inside = false; for x in min_x..max_x { // Check the half-space functions for all three edges to see if we're inside // the triangle. These functions are basically just a cross product between an // edge and a vector from the current raster position to the edge. The resulting // vector will either point into or out of the screen, so we can check which // side of the edge we're on by the sign of the Z component. See notes for // 'e[012]c' as for how we do the compare if e0x | e1x | e2x >= 0 { inside = true; // The cross product from the edge function not only tells us which side // we're on, but also the area of parallelogram formed by the two vectors. // We're basically getting twice the area of one of the three triangles // splitting the original triangle around the raster position. Those are // already barycentric coordinates, we just need to normalize them with // the triangle area we already computed with the cross product for the // backface culling test. Don't forget to remove the fill convention // (e[012]add) and comparison (+1) bias applied earlier let b0 = (e0x - e0add - 1) as f32 * inv_tri_a2; let b1 = (e1x - e1add - 1) as f32 * inv_tri_a2; let b2 = (e2x - e2add - 1) as f32 * inv_tri_a2; let idx = (x + idx_y) as isize; // Interpolate and test depth. Note that we are interpolating z/w, which // is linear in screen space, no special perspective correct interpolation // required. We also use a Z buffer, not a W buffer let z = v0.z + z10 * b2 + z20 * b0; let d = unsafe { depth_ptr.offset(idx) }; if unsafe { *d > z } { // Write depth unsafe { *d = z }; // To do perspective correct interpolation of attributes we need // to know w at the current raster position. We can compute it by // interpolating 1/w linearly and then taking the reciprocal let w_raster = 1.0 / (inv_w_0 + w10 * b2 + w20 * b0); // Interpolate color. Perspective correct interpolation requires us to // linearly interpolate col/w and then multiply by w let c_raster = (c0 * inv_w_0 + c10 * b2 + c20 * b0) * w_raster; // Shading let out = if $shade_per_pixel { // TODO: Also use faster 2xMAD form of barycentric interpolation for // the p/n attributes, just a bit tricky to get the delta setup // out of the per-vertex shading branch // Also do perspective correct interpolation of the vertex normal // and world space position, the shader might want these let p_raster = (p0 * inv_w_0 * b1 + p1 * inv_w_1 * b2 + p2 * inv_w_2 * b0) * w_raster; let n_raster = (n0 * inv_w_0 * b1 + n1 * inv_w_1 * b2 + n2 * inv_w_2 * b0) * w_raster; // Call shader // // TODO: We could just generate one rasterizer instance for each shader // or alternatively switch to a deferred shading approach shader(&p_raster, &n_raster, &c_raster, &eye, tick, cm) } else { // Just write interpolated per-vertex shading result c_raster }; // Gamma correct and write color unsafe { * fb.offset(idx) = rgbf_to_abgr32_gamma(out.x, out.y, out.z); } } } else { // Very basic traversal optimization. Once we're inside the triangle, we can // stop with the current row if we find ourselves outside again if inside { break; } } // Step X e0x += fp_dy01; e1x += fp_dy12; e2x += fp_dy20; } // Step Y e0y += fp_dx10; e1y += fp_dx21; e2y += fp_dx02; } } }; } mk_rasterizer!(true , rasterize_and_shade_triangle_pixel ); mk_rasterizer!(false, rasterize_and_shade_triangle_vertex); // // ------------ // Entry Points // ------------ // #[no_mangle] pub extern fn rast_benchmark() { // Allocate framebuffer let w = 512; let h = 512; let mut fb: Vec<u32> = Vec::new(); fb.resize((w * h) as usize, 0); let fb_ptr = fb.as_mut_ptr(); // Benchmark name, reference speed and function let benchmarks:[(&str, i64, &Fn() -> ()); 12] = [ ("KillerooV" , 1812, &|| rast_draw(0, RenderMode::Fill, 0 , 5, 0, 0, 0., w, h, fb_ptr)), ("HeadV" , 2500, &|| rast_draw(0, RenderMode::Fill, 1 , 5, 0, 0, 0., w, h, fb_ptr)), ("HandV" , 910, &|| rast_draw(0, RenderMode::Fill, 4 , 5, 0, 0, 0., w, h, fb_ptr)), ("TorusKnotV" , 1287, &|| rast_draw(0, RenderMode::Fill, 6 , 5, 0, 0, 0., w, h, fb_ptr)), ("CubeV" , 1107, &|| rast_draw(0, RenderMode::Fill, 9 , 5, 0, 0, 0., w, h, fb_ptr)), ("CornellBoxV", 1326, &|| rast_draw(0, RenderMode::Fill, 11, 5, 0, 0, 0., w, h, fb_ptr)), ("KillerooP" , 2435, &|| rast_draw(1, RenderMode::Fill, 0 , 5, 0, 0, 0., w, h, fb_ptr)), ("HeadP" , 3841, &|| rast_draw(1, RenderMode::Fill, 1 , 5, 0, 0, 0., w, h, fb_ptr)), ("HandP" , 1689, &|| rast_draw(1, RenderMode::Fill, 4 , 5, 0, 0, 0., w, h, fb_ptr)), ("TorusKnotP" , 3132, &|| rast_draw(1, RenderMode::Fill, 6 , 5, 0, 0, 0., w, h, fb_ptr)), ("CubeP" , 3461, &|| rast_draw(1, RenderMode::Fill, 9 , 5, 0, 0, 0., w, h, fb_ptr)), ("CornellBoxP", 3786, &|| rast_draw(1, RenderMode::Fill, 11, 5, 0, 0, 0., w, h, fb_ptr)) ]; // Run once so all the one-time initialization etc. is done for i in 0..benchmarks.len() { benchmarks[i].2(); } // Vector storing the best time let mut timings: Vec<i64> = Vec::new(); timings.resize(benchmarks.len(), i64::MAX); // Run all benchmarks multiple times let num_runs = 40; for _ in 0..num_runs { for i in 0..benchmarks.len() { // Measure and run let bench_fun = benchmarks[i].2; let start = PreciseTime::now(); bench_fun(); let end = PreciseTime::now(); // Best time? timings[i] = cmp::min(timings[i], start.to(end).num_microseconds().unwrap()); } } // Overall time let mut total_ref = 0; let mut total_now = 0; for i in 0..benchmarks.len() { total_ref += benchmarks[i].1; total_now += timings[i]; } // Benchmark table let hr = "-------------------------------------------------"; println!("\n Name | Ref | Now | %-Diff"); println!("{}", hr); for i in 0..benchmarks.len() + 1 { let name; let time_ref; let time_now; let time_diff; let percent_diff; // Print summary as last entry if i == benchmarks.len() { name = "<Total>"; time_ref = total_ref; time_now = total_now; time_diff = total_now - total_ref; percent_diff = (time_diff as f64 / total_ref as f64) * 100.0; println!("{}", hr); } else { name = benchmarks[i].0; time_ref = benchmarks[i].1; time_now = timings[i]; time_diff = time_now - time_ref; percent_diff = (time_diff as f64 / time_ref as f64) * 100.0; } let neutral = ansi_term::Colour::White.dimmed(); let regression = ansi_term::Colour::Red .normal(); let improvement = ansi_term::Colour::Green.normal(); let tolerance = 1.0; let style = if percent_diff <= -tolerance { improvement } else if percent_diff >= tolerance { regression } else { neutral }; let display_str = format!("{:^16}|{:^7}μs |{:^7}μs | {:^+7.2}%", name, time_ref, time_now, percent_diff); println!("{}", style.paint(display_str)); } println!(""); } #[repr(i32)] #[derive(PartialEq, Copy, Clone)] pub enum RenderMode { Point, Line, Fill } #[no_mangle] pub extern fn rast_draw(shade_per_pixel: i32, mode: RenderMode, mesh_idx: i32, shader_idx: i32, env_map_idx: i32, bg_idx: i32, tick: f64, w: i32, h: i32, fb: *mut u32) { // Transform, rasterize and shade mesh // Avoid passing a bool over the FFI, convert now let shade_per_pixel: bool = shade_per_pixel != 0; // let tick: f64 = 0.0; // Scene (mesh, camera, shader, environment)<|fim▁hole|> let eye = camera(tick); let (_, show_cm, shader) = shader_by_idx(shader_idx); let (_, cm) = cm_set_by_idx(env_map_idx); // Number of threads we're supposed to use lazy_static! { static ref NUM_THREADS: usize = { // Vertex processing seems to be slightly faster if we have one thread for each // physical core, rasterization / shading benefits strongly from HT. Use the full // thread count for now num_cpus::get() }; } // Reusable thread pool struct SyncPool { cell: UnsafeCell<scoped_threadpool::Pool> } unsafe impl Sync for SyncPool { } lazy_static! { static ref POOL: SyncPool = { let pool = scoped_threadpool::Pool::new(*NUM_THREADS as u32); SyncPool { cell: UnsafeCell::new(pool) } }; } let mut pool = unsafe { &mut *POOL.cell.get() }; // Depth buffer let mut depth: Vec<f32> = Vec::new(); // Prepare output buffer for transformed vertices let mut vtx_transf: Vec<TransformedVertex> = Vec::with_capacity(mesh.vtx.len()); unsafe { vtx_transf.set_len(mesh.vtx.len()); } { // This is rather awkward, but we do gradient filling and depth clearing while we wait // for the vertex processing worker threads. Gives a small speedup let mut bg_and_depth = || { // Fill the framebuffer with a gradient or solid color draw_bg_gradient(bg_idx, w, h, fb); // Allocate and clear depth buffer if mode == RenderMode::Fill { depth.resize((w * h) as usize, 1.0); } }; // Transform and shade vertices. Only pick parallel processing if we // actually have a significant vertex processing workload let do_vtx_shading = !shade_per_pixel && mode == RenderMode::Fill; let ndim = mesh.normalize_dimensions(); if *NUM_THREADS > 1 && ( mesh.vtx.len() > 10000 || (do_vtx_shading && mesh.vtx.len() > 2500)) { // Parallel processing // Chunked iterators for both vertex input and output let vtx_chunk_size = cmp::max(mesh.vtx.len() / *NUM_THREADS, 512); let vtx_transf_chunks = vtx_transf.chunks_mut(vtx_chunk_size); let vtx_mesh_chunks = mesh.vtx.chunks(vtx_chunk_size); // Process chunks in parallel pool.scoped(|scoped| { for (cin, cout) in vtx_mesh_chunks.zip(vtx_transf_chunks) { scoped.execute(move || { transform_vertices(cin, cout, &ndim, w, h, &eye); if do_vtx_shading { for vtx in cout { vtx.col = shader(&vtx.world, &vtx.n, &vtx.col, &eye, tick, cm); } } }); } // Do this before we start waiting for the pool bg_and_depth(); }); } else { // Serial processing transform_vertices (&mesh.vtx[..], &mut vtx_transf[..], &ndim, w, h, &eye); if do_vtx_shading { for vtx in &mut vtx_transf { vtx.col = shader(&vtx.world, &vtx.n, &vtx.col, &eye, tick, cm); } } bg_and_depth(); } } // Need to be able to send our buffer pointers across thread boundaries #[derive(Copy, Clone)] struct SendBufPtr<T> { ptr: *mut T } unsafe impl Send for SendBufPtr<u32> { } unsafe impl Send for SendBufPtr<f32> { } let send_fb = SendBufPtr { ptr: fb }; let send_depth = SendBufPtr { ptr: depth.as_mut_ptr() }; // Draw match mode { RenderMode::Point => { for t in &mesh.tri { for idx in &[t.v0, t.v1, t.v2] { let vp = &vtx_transf[*idx as usize].vp; let x = vp.x as i32; let y = vp.y as i32; if x < 0 || x >= w || y < 0 || y >= h { continue } let idx = x + y * w; unsafe { * fb.offset(idx as isize) = 0x00FFFFFF; } } } } RenderMode::Line => { // Line drawing can be done in parallel pool.scoped(|scoped| { let vtx: &Vec<TransformedVertex> = &vtx_transf; for chunk in mesh.tri.chunks(cmp::max(mesh.tri.len() / *NUM_THREADS, 512)) { scoped.execute(move || { for t in chunk { for &(idx1, idx2) in &[(t.v0, t.v1), (t.v1, t.v2), (t.v2, t.v0)] { let vp1 = &vtx[idx1 as usize].vp; let vp2 = &vtx[idx2 as usize].vp; draw_line(vp1.x, vp1.y, vp2.x, vp2.y, send_fb.ptr, w, h); } } }); } }); } RenderMode::Fill => { // Rasterize with a fixed-point half-space algorithm if *NUM_THREADS == 1 { // Serial implementation for t in &mesh.tri { // Triangle vertices let v0 = unsafe { vtx_transf.get_unchecked(t.v0 as usize) }; let v1 = unsafe { vtx_transf.get_unchecked(t.v1 as usize) }; let v2 = unsafe { vtx_transf.get_unchecked(t.v2 as usize) }; if shade_per_pixel { rasterize_and_shade_triangle_pixel( v0, v1, v2, &shader, &eye, tick, cm, 0, 0, w, h, w, send_fb.ptr, send_depth.ptr); } else { rasterize_and_shade_triangle_vertex( v0, v1, v2, &shader, &eye, tick, cm, 0, 0, w, h, w, send_fb.ptr, send_depth.ptr); } } } else { // Parallel implementation // Tiles static TILE_WDH: i32 = 64; static TILE_HGT: i32 = 64; static TILE_WDH_SHIFT: i32 = 6; static TILE_HGT_SHIFT: i32 = 6; struct Tile { tri_idx: Vec<i32>, x1: i32, y1: i32, x2: i32, y2: i32 }; let tw = (w + TILE_WDH - 1) / TILE_WDH; let th = (h + TILE_HGT - 1) / TILE_HGT; // Build tile array let mut tiles = Vec::new(); for ty in 0..th { for tx in 0..tw { let x1 = tx * TILE_WDH; let y1 = ty * TILE_HGT; let x2 = cmp::min(x1 + TILE_WDH, w); // Clip upper bound against FB let y2 = cmp::min(y1 + TILE_HGT, h); tiles.push(Tile { // We can prevent a lot of allocations by starting // with a reasonable capacity tri_idx: Vec::with_capacity(256), x1: x1, y1: y1, x2: x2, y2: y2, }); } } let vtx: &Vec<TransformedVertex> = &vtx_transf; // Bin mesh triangles into tiles // // TODO: This is slow for vertex heavy scenes, serial and duplicates // work from the rasterizer like fixed-point conversion, AABB // finding and backface culling. Optimize / unify this // for i in 0..mesh.tri.len() { let t = unsafe { &mesh.tri.get_unchecked(i as usize) }; let v0 = unsafe { vtx.get_unchecked(t.v0 as usize).vp }; let v1 = unsafe { vtx.get_unchecked(t.v1 as usize).vp }; let v2 = unsafe { vtx.get_unchecked(t.v2 as usize).vp }; let x0 = (v0.x * 16.0) as i32; let y0 = (v0.y * 16.0) as i32; let x1 = (v1.x * 16.0) as i32; let y1 = (v1.y * 16.0) as i32; let x2 = (v2.x * 16.0) as i32; let y2 = (v2.y * 16.0) as i32; let tri_a2 = (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0); if tri_a2 <= 0 { continue } let min_x = (min3(x0, x1, x2) + 0xF) >> 4; let min_y = (min3(y0, y1, y2) + 0xF) >> 4; let max_x = (max3(x0, x1, x2) + 0xF) >> 4; let max_y = (max3(y0, y1, y2) + 0xF) >> 4; // To tile coordinates let min_x = min_x >> TILE_WDH_SHIFT; let min_y = min_y >> TILE_HGT_SHIFT; let max_x = (max_x >> TILE_WDH_SHIFT) + 1; let max_y = (max_y >> TILE_HGT_SHIFT) + 1; // Clip against framebuffer let min_x = na::clamp(min_x, 0, tw); let min_y = na::clamp(min_y, 0, th); let max_x = na::clamp(max_x, 0, tw); let max_y = na::clamp(max_y, 0, th); // Add to tile bins for ty in min_y..max_y { for tx in min_x..max_x { unsafe { tiles.get_unchecked_mut ((tx + ty * tw) as usize).tri_idx.push(i as i32); } } } } // Scheduling generally works better when we start with the most // expensive tiles, which tend to be the ones with the most triangles tiles.sort_by(|a, b| b.tri_idx.len().cmp(&a.tri_idx.len())); pool.scoped(|scoped| { for tile in tiles { // Don't create jobs for empty tiles if tile.tri_idx.is_empty() { continue } scoped.execute(move || { for i in tile.tri_idx { // Triangle vertices let t = unsafe { &mesh.tri.get_unchecked(i as usize) }; let v0 = unsafe { vtx.get_unchecked(t.v0 as usize) }; let v1 = unsafe { vtx.get_unchecked(t.v1 as usize) }; let v2 = unsafe { vtx.get_unchecked(t.v2 as usize) }; if shade_per_pixel { rasterize_and_shade_triangle_pixel( v0, v1, v2, &shader, &eye, tick, cm, tile.x1, tile.y1, tile.x2, tile.y2, w, send_fb.ptr, send_depth.ptr); } else { rasterize_and_shade_triangle_vertex( v0, v1, v2, &shader, &eye, tick, cm, tile.x1, tile.y1, tile.x2, tile.y2, w, send_fb.ptr, send_depth.ptr); } } }); } }); } } } // Cube map unfolded LDR preview overlay if show_cm { cm.draw_cross(10, 10, w, h, fb); } }<|fim▁end|>
let (_, camera, mesh) = mesh_by_idx(mesh_idx);
<|file_name|>__manifest__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2016 Onestein (<http://www.onestein.eu>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). {<|fim▁hole|> 'license': 'AGPL-3', 'depends': ['auth_oauth'], 'data': [ 'data/auth_oauth_data.xml', ], }<|fim▁end|>
'name': 'OAuth2 Disable Login with Odoo.com', 'version': '10.0.1.0.0', 'category': 'Tools', 'author': 'Onestein',
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use std::str; use std::u32; use std::fmt::Write;<|fim▁hole|> extern crate crypto; use crypto::md5::Md5; use crypto::digest::Digest; // It takes two hex digits to make a byte, so check // the first 2.5 bytes for zero values fn first_five_hex_zero(input: &[u8; 16]) -> bool { let sum = (input[0] as u32) + (input[1] as u32) + (input[2] as u32 >> 4); sum == 0 } fn get_sixth_hex_char(input: &[u8; 16]) -> char { let mut buff = String::new(); let _ = write!(buff,"{:x}", input[2]); buff.as_bytes()[0] as char } fn get_seventh_hex_char(input: &[u8; 16]) -> char { let mut buff = String::new(); let _ = write!(buff,"{:x}", input[3] >> 4); buff.as_bytes()[0] as char } fn main() { // Puzzle input let door_id = "reyedfim"; let mut hasher = Md5::new(); let mut password = "".to_owned(); let target_password_length = 8; // Static buffer to hold the result let mut hash_output = [0u8; 16]; // Loop through door_id + [0..max] to find hashes that // start with five zeros for i in 0..u32::max_value() { let mut test_value = String::new(); let _ = write!(test_value,"{}{}", door_id, i); hasher.reset(); hasher.input(test_value.as_bytes()); hasher.result(&mut hash_output); if first_five_hex_zero(&hash_output) { let next_char = get_sixth_hex_char(&hash_output); password.push(next_char); } if password.len() >= target_password_length { break; } } println!("Part 1: password = '{}'", password); assert!(password == "f97c354d"); // Part 2 let mut password_part2_bytes = [0u8; 8]; //" ".as_bytes(); let mut set_characters = 0; // Loop through door_id + [0..max] to find hashes that // start with five zeros for i in 0..u32::max_value() { let mut test_value = String::new(); let _ = write!(test_value,"{}{}", door_id, i); hasher.reset(); hasher.input(test_value.as_bytes()); hasher.result(&mut hash_output); if first_five_hex_zero(&hash_output) { let next_pos = get_sixth_hex_char(&hash_output); let next_char = get_seventh_hex_char(&hash_output); if let Some(index) = next_pos.to_digit(10) { if index < 8 { if password_part2_bytes[index as usize] == 0 { password_part2_bytes[index as usize] = next_char as u8; set_characters += 1; } } } } if set_characters == target_password_length { break; } } let password_part2 = str::from_utf8(&password_part2_bytes).unwrap(); println!("Part 2: password = '{}'", password_part2); assert!(password_part2 == "863dde27"); } #[test] fn test1() { let test_value = "abc3231929"; let mut hasher = Md5::new(); hasher.input(test_value.as_bytes()); let hash_result = hasher.result_str(); println!("{}", hash_result); let mut buff = [0;16]; hasher.result(&mut buff); let position = get_sixth_hex_char(&buff); let character = get_seventh_hex_char(&buff); println!("pos: {}", position); println!("chr: {}", character); }<|fim▁end|>
<|file_name|>test_finite_field.py<|end_file_name|><|fim▁begin|>from crpyto_tool.libs.finite_field_op import FiniteFieldNumber if __name__ == '__main__': magical_number = FiniteFieldNumber(FiniteFieldNumber.magical_number, False)<|fim▁hole|> print 'Q5-(1):' + str(number2 - number3) number0 = FiniteFieldNumber('1000110') number1 = FiniteFieldNumber('10001011') print 'Q5-(2):' + str(number0 + number1) print 'Q5-(3):' + str(number0 * number1) number4 = FiniteFieldNumber('10000111111010') print number4 / magical_number print FiniteFieldNumber('11110101') * FiniteFieldNumber('1000110')<|fim▁end|>
print 'p(x): ' + str(magical_number) number2 = FiniteFieldNumber('0') number3 = FiniteFieldNumber('1000110')
<|file_name|>db_create.py<|end_file_name|><|fim▁begin|>from migrate.versioning import api from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO from app import db import os.path db.create_all() if not os.path.exists(SQLALCHEMY_MIGRATE_REPO): api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository') api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) else:<|fim▁hole|><|fim▁end|>
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
<|file_name|>test_shapely_to_mpl.py<|end_file_name|><|fim▁begin|># (C) British Crown Copyright 2011 - 2012, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # cartopy 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with cartopy. If not, see <http://www.gnu.org/licenses/>. import numpy as np from matplotlib.testing.decorators import image_comparison as mpl_image_comparison import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.collections import PatchCollection from matplotlib.path import Path import shapely.geometry import cartopy.crs as ccrs import cartopy.mpl_integration.patch as cpatch from cartopy.tests.mpl import image_comparison @image_comparison(baseline_images=['poly_interiors']) def test_polygon_interiors(): ax = plt.subplot(211, projection=ccrs.PlateCarree()) ax.coastlines() ax.set_global() # XXX could be the default??? pth = Path([[0, 45], [60, 45], [60, -45], [0, -45], [0, -45], [10, 20], [10, -20], [40, -20], [40, 20], [10, -20]], [1, 2, 2, 2, 79, 1, 2, 2 , 2, 79]) patches_native = [] patches = [] for geos in cpatch.path_to_geos(pth): for pth in cpatch.geos_to_path(geos): patches.append(mpatches.PathPatch(pth)) # buffer by 10 degrees (leaves a small hole in the middle) geos_buffered = geos.buffer(10) for pth in cpatch.geos_to_path(geos_buffered): patches_native.append(mpatches.PathPatch(pth)) collection = PatchCollection(patches_native, facecolor='red', alpha=0.4, transform=ax.projection ) ax.add_collection(collection) collection = PatchCollection(patches, facecolor='yellow', alpha=0.4, transform=ccrs.Geodetic() ) ax.add_collection(collection) # test multiple interior polygons ax = plt.subplot(212, projection=ccrs.PlateCarree(), xlim=[-5, 15], ylim=[-5, 15]) ax.coastlines() <|fim▁hole|> ] poly = shapely.geometry.Polygon(exterior, interiors) patches = [] for pth in cpatch.geos_to_path(poly): patches.append(mpatches.PathPatch(pth)) collection = PatchCollection(patches, facecolor='yellow', alpha=0.4, transform=ccrs.Geodetic() ) ax.add_collection(collection) @image_comparison(baseline_images=['contour_with_interiors']) def test_contour_interiors(): # ############## produces a polygon with multiple holes: nx, ny = 10, 10 numlev = 2 lons, lats = np.meshgrid(np.linspace(-50, 50, nx), np.linspace(-45, 45, ny)) data = np.sin(np.sqrt(lons**2 + lats**2)) ax = plt.subplot(221, projection=ccrs.PlateCarree()) ax.set_global() plt.title("Native projection") plt.contourf(lons, lats, data, numlev, transform=ccrs.PlateCarree()) ax.coastlines() plt.subplot(222, projection=ccrs.PlateCarree()) plt.title("Non-native projection") ax = plt.gca() ax.set_global() plt.contourf(lons, lats, data, numlev, transform=ccrs.Geodetic()) ax.coastlines() ############## produces singular polygons (zero area polygons) numlev = 2 x, y = np.meshgrid(np.arange(-5.5, 5.5, 0.25), np.arange(-5.5, 5.5, 0.25)) dim = x.shape[0] data = Z = np.sin(np.sqrt(x**2 + y**2)) lats = np.arange(dim) + 30 lons = np.arange(dim) - 20 ax = plt.subplot(223, projection=ccrs.PlateCarree()) ax.set_global() plt.title("Native projection") plt.contourf(lons, lats, data, numlev, transform=ccrs.PlateCarree()) ax.coastlines() plt.subplot(224, projection=ccrs.PlateCarree()) plt.title("Non-native projection") ax = plt.gca() ax.set_global() cs = plt.contourf(lons, lats, data, numlev, transform=ccrs.Geodetic()) ax.coastlines() if __name__=='__main__': import nose nose.runmodule(argv=['-s','--with-doctest'], exit=False)<|fim▁end|>
exterior = np.array(shapely.geometry.box(0, 0, 12, 12).exterior.coords) interiors = [ np.array(shapely.geometry.box(1, 1, 2, 2, ccw=False).exterior.coords), np.array(shapely.geometry.box(1, 8, 2, 9, ccw=False).exterior.coords),